diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-10-18 21:23:11 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-10-18 21:23:11 -0400 |
commit | 4e0e329d9a2011f9f7a7c0a378dc3bff7b0a0283 (patch) | |
tree | a802614e01460631c694dfa118642d54c3d5fc79 /drivers | |
parent | e33b9dfa3008fcaa908dc0c8c472a812c400f839 (diff) | |
parent | 59a10b172fccaea793352c00fd9065f0a5b4ef70 (diff) |
Merge branch 'upstream'
Diffstat (limited to 'drivers')
69 files changed, 2283 insertions, 586 deletions
diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c index bfa8b76de403..2dbb1b0f11d5 100644 --- a/drivers/acpi/event.c +++ b/drivers/acpi/event.c | |||
@@ -58,9 +58,8 @@ acpi_system_read_event(struct file *file, char __user * buffer, size_t count, | |||
58 | return_VALUE(-EAGAIN); | 58 | return_VALUE(-EAGAIN); |
59 | 59 | ||
60 | result = acpi_bus_receive_event(&event); | 60 | result = acpi_bus_receive_event(&event); |
61 | if (result) { | 61 | if (result) |
62 | return_VALUE(-EIO); | 62 | return_VALUE(result); |
63 | } | ||
64 | 63 | ||
65 | chars_remaining = sprintf(str, "%s %s %08x %08x\n", | 64 | chars_remaining = sprintf(str, "%s %s %08x %08x\n", |
66 | event.device_class ? event. | 65 | event.device_class ? event. |
diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c index d74a7c5e75dd..4b6bf19c39c0 100644 --- a/drivers/atm/ambassador.c +++ b/drivers/atm/ambassador.c | |||
@@ -795,7 +795,7 @@ static void drain_rx_pools (amb_dev * dev) { | |||
795 | } | 795 | } |
796 | 796 | ||
797 | static inline void fill_rx_pool (amb_dev * dev, unsigned char pool, | 797 | static inline void fill_rx_pool (amb_dev * dev, unsigned char pool, |
798 | unsigned int __nocast priority) | 798 | gfp_t priority) |
799 | { | 799 | { |
800 | rx_in rx; | 800 | rx_in rx; |
801 | amb_rxq * rxq; | 801 | amb_rxq * rxq; |
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c index 58219744f5db..7f7ec288824d 100644 --- a/drivers/atm/firestream.c +++ b/drivers/atm/firestream.c | |||
@@ -1374,8 +1374,7 @@ static void reset_chip (struct fs_dev *dev) | |||
1374 | } | 1374 | } |
1375 | } | 1375 | } |
1376 | 1376 | ||
1377 | static void __devinit *aligned_kmalloc (int size, unsigned int __nocast flags, | 1377 | static void __devinit *aligned_kmalloc (int size, gfp_t flags, int alignment) |
1378 | int alignment) | ||
1379 | { | 1378 | { |
1380 | void *t; | 1379 | void *t; |
1381 | 1380 | ||
@@ -1466,7 +1465,7 @@ static inline int nr_buffers_in_freepool (struct fs_dev *dev, struct freepool *f | |||
1466 | working again after that... -- REW */ | 1465 | working again after that... -- REW */ |
1467 | 1466 | ||
1468 | static void top_off_fp (struct fs_dev *dev, struct freepool *fp, | 1467 | static void top_off_fp (struct fs_dev *dev, struct freepool *fp, |
1469 | unsigned int __nocast gfp_flags) | 1468 | gfp_t gfp_flags) |
1470 | { | 1469 | { |
1471 | struct FS_BPENTRY *qe, *ne; | 1470 | struct FS_BPENTRY *qe, *ne; |
1472 | struct sk_buff *skb; | 1471 | struct sk_buff *skb; |
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c index 6f1a83c9d9e0..14f6a6201da3 100644 --- a/drivers/atm/fore200e.c +++ b/drivers/atm/fore200e.c | |||
@@ -178,7 +178,7 @@ fore200e_irq_itoa(int irq) | |||
178 | 178 | ||
179 | 179 | ||
180 | static void* | 180 | static void* |
181 | fore200e_kmalloc(int size, unsigned int __nocast flags) | 181 | fore200e_kmalloc(int size, gfp_t flags) |
182 | { | 182 | { |
183 | void *chunk = kzalloc(size, flags); | 183 | void *chunk = kzalloc(size, flags); |
184 | 184 | ||
diff --git a/drivers/base/dmapool.c b/drivers/base/dmapool.c index 60a7ef6a201b..e2f64f91ed05 100644 --- a/drivers/base/dmapool.c +++ b/drivers/base/dmapool.c | |||
@@ -156,7 +156,7 @@ dma_pool_create (const char *name, struct device *dev, | |||
156 | 156 | ||
157 | 157 | ||
158 | static struct dma_page * | 158 | static struct dma_page * |
159 | pool_alloc_page (struct dma_pool *pool, unsigned int __nocast mem_flags) | 159 | pool_alloc_page (struct dma_pool *pool, gfp_t mem_flags) |
160 | { | 160 | { |
161 | struct dma_page *page; | 161 | struct dma_page *page; |
162 | int mapsize; | 162 | int mapsize; |
@@ -262,8 +262,7 @@ dma_pool_destroy (struct dma_pool *pool) | |||
262 | * If such a memory block can't be allocated, null is returned. | 262 | * If such a memory block can't be allocated, null is returned. |
263 | */ | 263 | */ |
264 | void * | 264 | void * |
265 | dma_pool_alloc (struct dma_pool *pool, unsigned int __nocast mem_flags, | 265 | dma_pool_alloc (struct dma_pool *pool, gfp_t mem_flags, dma_addr_t *handle) |
266 | dma_addr_t *handle) | ||
267 | { | 266 | { |
268 | unsigned long flags; | 267 | unsigned long flags; |
269 | struct dma_page *page; | 268 | struct dma_page *page; |
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 7e22a58926b8..a280e679b1ca 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -229,7 +229,7 @@ static int pkt_grow_pktlist(struct pktcdvd_device *pd, int nr_packets) | |||
229 | return 1; | 229 | return 1; |
230 | } | 230 | } |
231 | 231 | ||
232 | static void *pkt_rb_alloc(unsigned int __nocast gfp_mask, void *data) | 232 | static void *pkt_rb_alloc(gfp_t gfp_mask, void *data) |
233 | { | 233 | { |
234 | return kmalloc(sizeof(struct pkt_rb_node), gfp_mask); | 234 | return kmalloc(sizeof(struct pkt_rb_node), gfp_mask); |
235 | } | 235 | } |
@@ -2082,7 +2082,7 @@ static int pkt_close(struct inode *inode, struct file *file) | |||
2082 | } | 2082 | } |
2083 | 2083 | ||
2084 | 2084 | ||
2085 | static void *psd_pool_alloc(unsigned int __nocast gfp_mask, void *data) | 2085 | static void *psd_pool_alloc(gfp_t gfp_mask, void *data) |
2086 | { | 2086 | { |
2087 | return kmalloc(sizeof(struct packet_stacked_data), gfp_mask); | 2087 | return kmalloc(sizeof(struct packet_stacked_data), gfp_mask); |
2088 | } | 2088 | } |
diff --git a/drivers/block/scsi_ioctl.c b/drivers/block/scsi_ioctl.c index 079ec344eb47..382dea7b224c 100644 --- a/drivers/block/scsi_ioctl.c +++ b/drivers/block/scsi_ioctl.c | |||
@@ -201,15 +201,15 @@ static int verify_command(struct file *file, unsigned char *cmd) | |||
201 | return 0; | 201 | return 0; |
202 | } | 202 | } |
203 | 203 | ||
204 | /* And root can do any command.. */ | ||
205 | if (capable(CAP_SYS_RAWIO)) | ||
206 | return 0; | ||
207 | |||
204 | if (!type) { | 208 | if (!type) { |
205 | cmd_type[cmd[0]] = CMD_WARNED; | 209 | cmd_type[cmd[0]] = CMD_WARNED; |
206 | printk(KERN_WARNING "scsi: unknown opcode 0x%02x\n", cmd[0]); | 210 | printk(KERN_WARNING "scsi: unknown opcode 0x%02x\n", cmd[0]); |
207 | } | 211 | } |
208 | 212 | ||
209 | /* And root can do any command.. */ | ||
210 | if (capable(CAP_SYS_RAWIO)) | ||
211 | return 0; | ||
212 | |||
213 | /* Otherwise fail it with an "Operation not permitted" */ | 213 | /* Otherwise fail it with an "Operation not permitted" */ |
214 | return -EPERM; | 214 | return -EPERM; |
215 | } | 215 | } |
diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c index a1bf8f066c88..4fa85234d8b5 100644 --- a/drivers/bluetooth/bpa10x.c +++ b/drivers/bluetooth/bpa10x.c | |||
@@ -308,7 +308,7 @@ unlock: | |||
308 | } | 308 | } |
309 | 309 | ||
310 | static inline struct urb *bpa10x_alloc_urb(struct usb_device *udev, unsigned int pipe, | 310 | static inline struct urb *bpa10x_alloc_urb(struct usb_device *udev, unsigned int pipe, |
311 | size_t size, unsigned int __nocast flags, void *data) | 311 | size_t size, gfp_t flags, void *data) |
312 | { | 312 | { |
313 | struct urb *urb; | 313 | struct urb *urb; |
314 | struct usb_ctrlrequest *cr; | 314 | struct usb_ctrlrequest *cr; |
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c index 57c48bbf6fe6..6756cb20b753 100644 --- a/drivers/bluetooth/hci_usb.c +++ b/drivers/bluetooth/hci_usb.c | |||
@@ -132,7 +132,7 @@ static struct usb_device_id blacklist_ids[] = { | |||
132 | { } /* Terminating entry */ | 132 | { } /* Terminating entry */ |
133 | }; | 133 | }; |
134 | 134 | ||
135 | static struct _urb *_urb_alloc(int isoc, unsigned int __nocast gfp) | 135 | static struct _urb *_urb_alloc(int isoc, gfp_t gfp) |
136 | { | 136 | { |
137 | struct _urb *_urb = kmalloc(sizeof(struct _urb) + | 137 | struct _urb *_urb = kmalloc(sizeof(struct _urb) + |
138 | sizeof(struct usb_iso_packet_descriptor) * isoc, gfp); | 138 | sizeof(struct usb_iso_packet_descriptor) * isoc, gfp); |
diff --git a/drivers/char/mbcs.c b/drivers/char/mbcs.c index 3fa64c631108..c268ee04b2aa 100644 --- a/drivers/char/mbcs.c +++ b/drivers/char/mbcs.c | |||
@@ -830,6 +830,9 @@ static int __init mbcs_init(void) | |||
830 | { | 830 | { |
831 | int rv; | 831 | int rv; |
832 | 832 | ||
833 | if (!ia64_platform_is("sn2")) | ||
834 | return -ENODEV; | ||
835 | |||
833 | // Put driver into chrdevs[]. Get major number. | 836 | // Put driver into chrdevs[]. Get major number. |
834 | rv = register_chrdev(mbcs_major, DEVICE_NAME, &mbcs_ops); | 837 | rv = register_chrdev(mbcs_major, DEVICE_NAME, &mbcs_ops); |
835 | if (rv < 0) { | 838 | if (rv < 0) { |
diff --git a/drivers/char/n_r3964.c b/drivers/char/n_r3964.c index 97d6dc24b800..853c98cee64f 100644 --- a/drivers/char/n_r3964.c +++ b/drivers/char/n_r3964.c | |||
@@ -695,7 +695,7 @@ static void receive_char(struct r3964_info *pInfo, const unsigned char c) | |||
695 | { | 695 | { |
696 | TRACE_PE("IDLE - got STX but no space in rx_queue!"); | 696 | TRACE_PE("IDLE - got STX but no space in rx_queue!"); |
697 | pInfo->state=R3964_WAIT_FOR_RX_BUF; | 697 | pInfo->state=R3964_WAIT_FOR_RX_BUF; |
698 | mod_timer(&pInfo->tmr, R3964_TO_NO_BUF); | 698 | mod_timer(&pInfo->tmr, jiffies + R3964_TO_NO_BUF); |
699 | break; | 699 | break; |
700 | } | 700 | } |
701 | start_receiving: | 701 | start_receiving: |
@@ -705,7 +705,7 @@ start_receiving: | |||
705 | pInfo->last_rx = 0; | 705 | pInfo->last_rx = 0; |
706 | pInfo->flags &= ~R3964_ERROR; | 706 | pInfo->flags &= ~R3964_ERROR; |
707 | pInfo->state=R3964_RECEIVING; | 707 | pInfo->state=R3964_RECEIVING; |
708 | mod_timer(&pInfo->tmr, R3964_TO_ZVZ); | 708 | mod_timer(&pInfo->tmr, jiffies + R3964_TO_ZVZ); |
709 | pInfo->nRetry = 0; | 709 | pInfo->nRetry = 0; |
710 | put_char(pInfo, DLE); | 710 | put_char(pInfo, DLE); |
711 | flush(pInfo); | 711 | flush(pInfo); |
@@ -732,7 +732,7 @@ start_receiving: | |||
732 | if(pInfo->flags & R3964_BCC) | 732 | if(pInfo->flags & R3964_BCC) |
733 | { | 733 | { |
734 | pInfo->state = R3964_WAIT_FOR_BCC; | 734 | pInfo->state = R3964_WAIT_FOR_BCC; |
735 | mod_timer(&pInfo->tmr, R3964_TO_ZVZ); | 735 | mod_timer(&pInfo->tmr, jiffies + R3964_TO_ZVZ); |
736 | } | 736 | } |
737 | else | 737 | else |
738 | { | 738 | { |
@@ -744,7 +744,7 @@ start_receiving: | |||
744 | pInfo->last_rx = c; | 744 | pInfo->last_rx = c; |
745 | char_to_buf: | 745 | char_to_buf: |
746 | pInfo->rx_buf[pInfo->rx_position++] = c; | 746 | pInfo->rx_buf[pInfo->rx_position++] = c; |
747 | mod_timer(&pInfo->tmr, R3964_TO_ZVZ); | 747 | mod_timer(&pInfo->tmr, jiffies + R3964_TO_ZVZ); |
748 | } | 748 | } |
749 | } | 749 | } |
750 | /* else: overflow-msg? BUF_SIZE>MTU; should not happen? */ | 750 | /* else: overflow-msg? BUF_SIZE>MTU; should not happen? */ |
diff --git a/drivers/char/s3c2410-rtc.c b/drivers/char/s3c2410-rtc.c index ed867db550a9..e1a90d9a8756 100644 --- a/drivers/char/s3c2410-rtc.c +++ b/drivers/char/s3c2410-rtc.c | |||
@@ -564,6 +564,7 @@ static int s3c2410_rtc_resume(struct device *dev, u32 level) | |||
564 | 564 | ||
565 | static struct device_driver s3c2410_rtcdrv = { | 565 | static struct device_driver s3c2410_rtcdrv = { |
566 | .name = "s3c2410-rtc", | 566 | .name = "s3c2410-rtc", |
567 | .owner = THIS_MODULE, | ||
567 | .bus = &platform_bus_type, | 568 | .bus = &platform_bus_type, |
568 | .probe = s3c2410_rtc_probe, | 569 | .probe = s3c2410_rtc_probe, |
569 | .remove = s3c2410_rtc_remove, | 570 | .remove = s3c2410_rtc_remove, |
diff --git a/drivers/char/watchdog/pcwd_pci.c b/drivers/char/watchdog/pcwd_pci.c index 5a80adbf8032..0b8e493be045 100644 --- a/drivers/char/watchdog/pcwd_pci.c +++ b/drivers/char/watchdog/pcwd_pci.c | |||
@@ -50,8 +50,8 @@ | |||
50 | #include <asm/io.h> /* For inb/outb/... */ | 50 | #include <asm/io.h> /* For inb/outb/... */ |
51 | 51 | ||
52 | /* Module and version information */ | 52 | /* Module and version information */ |
53 | #define WATCHDOG_VERSION "1.01" | 53 | #define WATCHDOG_VERSION "1.02" |
54 | #define WATCHDOG_DATE "02 Sep 2005" | 54 | #define WATCHDOG_DATE "03 Sep 2005" |
55 | #define WATCHDOG_DRIVER_NAME "PCI-PC Watchdog" | 55 | #define WATCHDOG_DRIVER_NAME "PCI-PC Watchdog" |
56 | #define WATCHDOG_NAME "pcwd_pci" | 56 | #define WATCHDOG_NAME "pcwd_pci" |
57 | #define PFX WATCHDOG_NAME ": " | 57 | #define PFX WATCHDOG_NAME ": " |
@@ -70,19 +70,30 @@ | |||
70 | * These are the defines that describe the control status bits for the | 70 | * These are the defines that describe the control status bits for the |
71 | * PCI-PC Watchdog card. | 71 | * PCI-PC Watchdog card. |
72 | */ | 72 | */ |
73 | #define WD_PCI_WTRP 0x01 /* Watchdog Trip status */ | 73 | /* Port 1 : Control Status #1 */ |
74 | #define WD_PCI_HRBT 0x02 /* Watchdog Heartbeat */ | 74 | #define WD_PCI_WTRP 0x01 /* Watchdog Trip status */ |
75 | #define WD_PCI_TTRP 0x04 /* Temperature Trip status */ | 75 | #define WD_PCI_HRBT 0x02 /* Watchdog Heartbeat */ |
76 | #define WD_PCI_TTRP 0x04 /* Temperature Trip status */ | ||
77 | #define WD_PCI_RL2A 0x08 /* Relay 2 Active */ | ||
78 | #define WD_PCI_RL1A 0x10 /* Relay 1 Active */ | ||
79 | #define WD_PCI_R2DS 0x40 /* Relay 2 Disable Temperature-trip/reset */ | ||
80 | #define WD_PCI_RLY2 0x80 /* Activate Relay 2 on the board */ | ||
81 | /* Port 2 : Control Status #2 */ | ||
82 | #define WD_PCI_WDIS 0x10 /* Watchdog Disable */ | ||
83 | #define WD_PCI_ENTP 0x20 /* Enable Temperature Trip Reset */ | ||
84 | #define WD_PCI_WRSP 0x40 /* Watchdog wrote response */ | ||
85 | #define WD_PCI_PCMD 0x80 /* PC has sent command */ | ||
76 | 86 | ||
77 | /* according to documentation max. time to process a command for the pci | 87 | /* according to documentation max. time to process a command for the pci |
78 | * watchdog card is 100 ms, so we give it 150 ms to do it's job */ | 88 | * watchdog card is 100 ms, so we give it 150 ms to do it's job */ |
79 | #define PCI_COMMAND_TIMEOUT 150 | 89 | #define PCI_COMMAND_TIMEOUT 150 |
80 | 90 | ||
81 | /* Watchdog's internal commands */ | 91 | /* Watchdog's internal commands */ |
82 | #define CMD_GET_STATUS 0x04 | 92 | #define CMD_GET_STATUS 0x04 |
83 | #define CMD_GET_FIRMWARE_VERSION 0x08 | 93 | #define CMD_GET_FIRMWARE_VERSION 0x08 |
84 | #define CMD_READ_WATCHDOG_TIMEOUT 0x18 | 94 | #define CMD_READ_WATCHDOG_TIMEOUT 0x18 |
85 | #define CMD_WRITE_WATCHDOG_TIMEOUT 0x19 | 95 | #define CMD_WRITE_WATCHDOG_TIMEOUT 0x19 |
96 | #define CMD_GET_CLEAR_RESET_COUNT 0x84 | ||
86 | 97 | ||
87 | /* We can only use 1 card due to the /dev/watchdog restriction */ | 98 | /* We can only use 1 card due to the /dev/watchdog restriction */ |
88 | static int cards_found; | 99 | static int cards_found; |
@@ -91,15 +102,22 @@ static int cards_found; | |||
91 | static int temp_panic; | 102 | static int temp_panic; |
92 | static unsigned long is_active; | 103 | static unsigned long is_active; |
93 | static char expect_release; | 104 | static char expect_release; |
94 | static struct { | 105 | static struct { /* this is private data for each PCI-PC watchdog card */ |
95 | int supports_temp; /* Wether or not the card has a temperature device */ | 106 | int supports_temp; /* Wether or not the card has a temperature device */ |
96 | int boot_status; /* The card's boot status */ | 107 | int boot_status; /* The card's boot status */ |
97 | unsigned long io_addr; /* The cards I/O address */ | 108 | unsigned long io_addr; /* The cards I/O address */ |
98 | spinlock_t io_lock; | 109 | spinlock_t io_lock; /* the lock for io operations */ |
99 | struct pci_dev *pdev; | 110 | struct pci_dev *pdev; /* the PCI-device */ |
100 | } pcipcwd_private; | 111 | } pcipcwd_private; |
101 | 112 | ||
102 | /* module parameters */ | 113 | /* module parameters */ |
114 | #define QUIET 0 /* Default */ | ||
115 | #define VERBOSE 1 /* Verbose */ | ||
116 | #define DEBUG 2 /* print fancy stuff too */ | ||
117 | static int debug = QUIET; | ||
118 | module_param(debug, int, 0); | ||
119 | MODULE_PARM_DESC(debug, "Debug level: 0=Quiet, 1=Verbose, 2=Debug (default=0)"); | ||
120 | |||
103 | #define WATCHDOG_HEARTBEAT 2 /* 2 sec default heartbeat */ | 121 | #define WATCHDOG_HEARTBEAT 2 /* 2 sec default heartbeat */ |
104 | static int heartbeat = WATCHDOG_HEARTBEAT; | 122 | static int heartbeat = WATCHDOG_HEARTBEAT; |
105 | module_param(heartbeat, int, 0); | 123 | module_param(heartbeat, int, 0); |
@@ -117,6 +135,10 @@ static int send_command(int cmd, int *msb, int *lsb) | |||
117 | { | 135 | { |
118 | int got_response, count; | 136 | int got_response, count; |
119 | 137 | ||
138 | if (debug >= DEBUG) | ||
139 | printk(KERN_DEBUG PFX "sending following data cmd=0x%02x msb=0x%02x lsb=0x%02x\n", | ||
140 | cmd, *msb, *lsb); | ||
141 | |||
120 | spin_lock(&pcipcwd_private.io_lock); | 142 | spin_lock(&pcipcwd_private.io_lock); |
121 | /* If a command requires data it should be written first. | 143 | /* If a command requires data it should be written first. |
122 | * Data for commands with 8 bits of data should be written to port 4. | 144 | * Data for commands with 8 bits of data should be written to port 4. |
@@ -131,10 +153,19 @@ static int send_command(int cmd, int *msb, int *lsb) | |||
131 | /* wait till the pci card processed the command, signaled by | 153 | /* wait till the pci card processed the command, signaled by |
132 | * the WRSP bit in port 2 and give it a max. timeout of | 154 | * the WRSP bit in port 2 and give it a max. timeout of |
133 | * PCI_COMMAND_TIMEOUT to process */ | 155 | * PCI_COMMAND_TIMEOUT to process */ |
134 | got_response = inb_p(pcipcwd_private.io_addr + 2) & 0x40; | 156 | got_response = inb_p(pcipcwd_private.io_addr + 2) & WD_PCI_WRSP; |
135 | for (count = 0; (count < PCI_COMMAND_TIMEOUT) && (!got_response); count++) { | 157 | for (count = 0; (count < PCI_COMMAND_TIMEOUT) && (!got_response); count++) { |
136 | mdelay(1); | 158 | mdelay(1); |
137 | got_response = inb_p(pcipcwd_private.io_addr + 2) & 0x40; | 159 | got_response = inb_p(pcipcwd_private.io_addr + 2) & WD_PCI_WRSP; |
160 | } | ||
161 | |||
162 | if (debug >= DEBUG) { | ||
163 | if (got_response) { | ||
164 | printk(KERN_DEBUG PFX "time to process command was: %d ms\n", | ||
165 | count); | ||
166 | } else { | ||
167 | printk(KERN_DEBUG PFX "card did not respond on command!\n"); | ||
168 | } | ||
138 | } | 169 | } |
139 | 170 | ||
140 | if (got_response) { | 171 | if (got_response) { |
@@ -144,12 +175,66 @@ static int send_command(int cmd, int *msb, int *lsb) | |||
144 | 175 | ||
145 | /* clear WRSP bit */ | 176 | /* clear WRSP bit */ |
146 | inb_p(pcipcwd_private.io_addr + 6); | 177 | inb_p(pcipcwd_private.io_addr + 6); |
178 | |||
179 | if (debug >= DEBUG) | ||
180 | printk(KERN_DEBUG PFX "received following data for cmd=0x%02x: msb=0x%02x lsb=0x%02x\n", | ||
181 | cmd, *msb, *lsb); | ||
147 | } | 182 | } |
183 | |||
148 | spin_unlock(&pcipcwd_private.io_lock); | 184 | spin_unlock(&pcipcwd_private.io_lock); |
149 | 185 | ||
150 | return got_response; | 186 | return got_response; |
151 | } | 187 | } |
152 | 188 | ||
189 | static inline void pcipcwd_check_temperature_support(void) | ||
190 | { | ||
191 | if (inb_p(pcipcwd_private.io_addr) != 0xF0) | ||
192 | pcipcwd_private.supports_temp = 1; | ||
193 | } | ||
194 | |||
195 | static int pcipcwd_get_option_switches(void) | ||
196 | { | ||
197 | int option_switches; | ||
198 | |||
199 | option_switches = inb_p(pcipcwd_private.io_addr + 3); | ||
200 | return option_switches; | ||
201 | } | ||
202 | |||
203 | static void pcipcwd_show_card_info(void) | ||
204 | { | ||
205 | int got_fw_rev, fw_rev_major, fw_rev_minor; | ||
206 | char fw_ver_str[20]; /* The cards firmware version */ | ||
207 | int option_switches; | ||
208 | |||
209 | got_fw_rev = send_command(CMD_GET_FIRMWARE_VERSION, &fw_rev_major, &fw_rev_minor); | ||
210 | if (got_fw_rev) { | ||
211 | sprintf(fw_ver_str, "%u.%02u", fw_rev_major, fw_rev_minor); | ||
212 | } else { | ||
213 | sprintf(fw_ver_str, "<card no answer>"); | ||
214 | } | ||
215 | |||
216 | /* Get switch settings */ | ||
217 | option_switches = pcipcwd_get_option_switches(); | ||
218 | |||
219 | printk(KERN_INFO PFX "Found card at port 0x%04x (Firmware: %s) %s temp option\n", | ||
220 | (int) pcipcwd_private.io_addr, fw_ver_str, | ||
221 | (pcipcwd_private.supports_temp ? "with" : "without")); | ||
222 | |||
223 | printk(KERN_INFO PFX "Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n", | ||
224 | option_switches, | ||
225 | ((option_switches & 0x10) ? "ON" : "OFF"), | ||
226 | ((option_switches & 0x08) ? "ON" : "OFF")); | ||
227 | |||
228 | if (pcipcwd_private.boot_status & WDIOF_CARDRESET) | ||
229 | printk(KERN_INFO PFX "Previous reset was caused by the Watchdog card\n"); | ||
230 | |||
231 | if (pcipcwd_private.boot_status & WDIOF_OVERHEAT) | ||
232 | printk(KERN_INFO PFX "Card sensed a CPU Overheat\n"); | ||
233 | |||
234 | if (pcipcwd_private.boot_status == 0) | ||
235 | printk(KERN_INFO PFX "No previous trip detected - Cold boot or reset\n"); | ||
236 | } | ||
237 | |||
153 | static int pcipcwd_start(void) | 238 | static int pcipcwd_start(void) |
154 | { | 239 | { |
155 | int stat_reg; | 240 | int stat_reg; |
@@ -161,11 +246,14 @@ static int pcipcwd_start(void) | |||
161 | stat_reg = inb_p(pcipcwd_private.io_addr + 2); | 246 | stat_reg = inb_p(pcipcwd_private.io_addr + 2); |
162 | spin_unlock(&pcipcwd_private.io_lock); | 247 | spin_unlock(&pcipcwd_private.io_lock); |
163 | 248 | ||
164 | if (stat_reg & 0x10) { | 249 | if (stat_reg & WD_PCI_WDIS) { |
165 | printk(KERN_ERR PFX "Card timer not enabled\n"); | 250 | printk(KERN_ERR PFX "Card timer not enabled\n"); |
166 | return -1; | 251 | return -1; |
167 | } | 252 | } |
168 | 253 | ||
254 | if (debug >= VERBOSE) | ||
255 | printk(KERN_DEBUG PFX "Watchdog started\n"); | ||
256 | |||
169 | return 0; | 257 | return 0; |
170 | } | 258 | } |
171 | 259 | ||
@@ -183,18 +271,25 @@ static int pcipcwd_stop(void) | |||
183 | stat_reg = inb_p(pcipcwd_private.io_addr + 2); | 271 | stat_reg = inb_p(pcipcwd_private.io_addr + 2); |
184 | spin_unlock(&pcipcwd_private.io_lock); | 272 | spin_unlock(&pcipcwd_private.io_lock); |
185 | 273 | ||
186 | if (!(stat_reg & 0x10)) { | 274 | if (!(stat_reg & WD_PCI_WDIS)) { |
187 | printk(KERN_ERR PFX "Card did not acknowledge disable attempt\n"); | 275 | printk(KERN_ERR PFX "Card did not acknowledge disable attempt\n"); |
188 | return -1; | 276 | return -1; |
189 | } | 277 | } |
190 | 278 | ||
279 | if (debug >= VERBOSE) | ||
280 | printk(KERN_DEBUG PFX "Watchdog stopped\n"); | ||
281 | |||
191 | return 0; | 282 | return 0; |
192 | } | 283 | } |
193 | 284 | ||
194 | static int pcipcwd_keepalive(void) | 285 | static int pcipcwd_keepalive(void) |
195 | { | 286 | { |
196 | /* Re-trigger watchdog by writing to port 0 */ | 287 | /* Re-trigger watchdog by writing to port 0 */ |
197 | outb_p(0x42, pcipcwd_private.io_addr); | 288 | outb_p(0x42, pcipcwd_private.io_addr); /* send out any data */ |
289 | |||
290 | if (debug >= DEBUG) | ||
291 | printk(KERN_DEBUG PFX "Watchdog keepalive signal send\n"); | ||
292 | |||
198 | return 0; | 293 | return 0; |
199 | } | 294 | } |
200 | 295 | ||
@@ -210,29 +305,64 @@ static int pcipcwd_set_heartbeat(int t) | |||
210 | send_command(CMD_WRITE_WATCHDOG_TIMEOUT, &t_msb, &t_lsb); | 305 | send_command(CMD_WRITE_WATCHDOG_TIMEOUT, &t_msb, &t_lsb); |
211 | 306 | ||
212 | heartbeat = t; | 307 | heartbeat = t; |
308 | if (debug >= VERBOSE) | ||
309 | printk(KERN_DEBUG PFX "New heartbeat: %d\n", | ||
310 | heartbeat); | ||
311 | |||
213 | return 0; | 312 | return 0; |
214 | } | 313 | } |
215 | 314 | ||
216 | static int pcipcwd_get_status(int *status) | 315 | static int pcipcwd_get_status(int *status) |
217 | { | 316 | { |
218 | int new_status; | 317 | int control_status; |
219 | 318 | ||
220 | *status=0; | 319 | *status=0; |
221 | new_status = inb_p(pcipcwd_private.io_addr + 1); | 320 | control_status = inb_p(pcipcwd_private.io_addr + 1); |
222 | if (new_status & WD_PCI_WTRP) | 321 | if (control_status & WD_PCI_WTRP) |
223 | *status |= WDIOF_CARDRESET; | 322 | *status |= WDIOF_CARDRESET; |
224 | if (new_status & WD_PCI_TTRP) { | 323 | if (control_status & WD_PCI_TTRP) { |
225 | *status |= WDIOF_OVERHEAT; | 324 | *status |= WDIOF_OVERHEAT; |
226 | if (temp_panic) | 325 | if (temp_panic) |
227 | panic(PFX "Temperature overheat trip!\n"); | 326 | panic(PFX "Temperature overheat trip!\n"); |
228 | } | 327 | } |
229 | 328 | ||
329 | if (debug >= DEBUG) | ||
330 | printk(KERN_DEBUG PFX "Control Status #1: 0x%02x\n", | ||
331 | control_status); | ||
332 | |||
230 | return 0; | 333 | return 0; |
231 | } | 334 | } |
232 | 335 | ||
233 | static int pcipcwd_clear_status(void) | 336 | static int pcipcwd_clear_status(void) |
234 | { | 337 | { |
235 | outb_p(0x01, pcipcwd_private.io_addr + 1); | 338 | int control_status; |
339 | int msb; | ||
340 | int reset_counter; | ||
341 | |||
342 | if (debug >= VERBOSE) | ||
343 | printk(KERN_INFO PFX "clearing watchdog trip status & LED\n"); | ||
344 | |||
345 | control_status = inb_p(pcipcwd_private.io_addr + 1); | ||
346 | |||
347 | if (debug >= DEBUG) { | ||
348 | printk(KERN_DEBUG PFX "status was: 0x%02x\n", control_status); | ||
349 | printk(KERN_DEBUG PFX "sending: 0x%02x\n", | ||
350 | (control_status & WD_PCI_R2DS) | WD_PCI_WTRP); | ||
351 | } | ||
352 | |||
353 | /* clear trip status & LED and keep mode of relay 2 */ | ||
354 | outb_p((control_status & WD_PCI_R2DS) | WD_PCI_WTRP, pcipcwd_private.io_addr + 1); | ||
355 | |||
356 | /* clear reset counter */ | ||
357 | msb=0; | ||
358 | reset_counter=0xff; | ||
359 | send_command(CMD_GET_CLEAR_RESET_COUNT, &msb, &reset_counter); | ||
360 | |||
361 | if (debug >= DEBUG) { | ||
362 | printk(KERN_DEBUG PFX "reset count was: 0x%02x\n", | ||
363 | reset_counter); | ||
364 | } | ||
365 | |||
236 | return 0; | 366 | return 0; |
237 | } | 367 | } |
238 | 368 | ||
@@ -242,11 +372,18 @@ static int pcipcwd_get_temperature(int *temperature) | |||
242 | if (!pcipcwd_private.supports_temp) | 372 | if (!pcipcwd_private.supports_temp) |
243 | return -ENODEV; | 373 | return -ENODEV; |
244 | 374 | ||
375 | *temperature = inb_p(pcipcwd_private.io_addr); | ||
376 | |||
245 | /* | 377 | /* |
246 | * Convert celsius to fahrenheit, since this was | 378 | * Convert celsius to fahrenheit, since this was |
247 | * the decided 'standard' for this return value. | 379 | * the decided 'standard' for this return value. |
248 | */ | 380 | */ |
249 | *temperature = ((inb_p(pcipcwd_private.io_addr)) * 9 / 5) + 32; | 381 | *temperature = (*temperature * 9 / 5) + 32; |
382 | |||
383 | if (debug >= DEBUG) { | ||
384 | printk(KERN_DEBUG PFX "temperature is: %d F\n", | ||
385 | *temperature); | ||
386 | } | ||
250 | 387 | ||
251 | return 0; | 388 | return 0; |
252 | } | 389 | } |
@@ -256,7 +393,7 @@ static int pcipcwd_get_temperature(int *temperature) | |||
256 | */ | 393 | */ |
257 | 394 | ||
258 | static ssize_t pcipcwd_write(struct file *file, const char __user *data, | 395 | static ssize_t pcipcwd_write(struct file *file, const char __user *data, |
259 | size_t len, loff_t *ppos) | 396 | size_t len, loff_t *ppos) |
260 | { | 397 | { |
261 | /* See if we got the magic character 'V' and reload the timer */ | 398 | /* See if we got the magic character 'V' and reload the timer */ |
262 | if (len) { | 399 | if (len) { |
@@ -381,8 +518,11 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file, | |||
381 | static int pcipcwd_open(struct inode *inode, struct file *file) | 518 | static int pcipcwd_open(struct inode *inode, struct file *file) |
382 | { | 519 | { |
383 | /* /dev/watchdog can only be opened once */ | 520 | /* /dev/watchdog can only be opened once */ |
384 | if (test_and_set_bit(0, &is_active)) | 521 | if (test_and_set_bit(0, &is_active)) { |
522 | if (debug >= VERBOSE) | ||
523 | printk(KERN_ERR PFX "Attempt to open already opened device.\n"); | ||
385 | return -EBUSY; | 524 | return -EBUSY; |
525 | } | ||
386 | 526 | ||
387 | /* Activate */ | 527 | /* Activate */ |
388 | pcipcwd_start(); | 528 | pcipcwd_start(); |
@@ -492,19 +632,10 @@ static struct notifier_block pcipcwd_notifier = { | |||
492 | * Init & exit routines | 632 | * Init & exit routines |
493 | */ | 633 | */ |
494 | 634 | ||
495 | static inline void check_temperature_support(void) | ||
496 | { | ||
497 | if (inb_p(pcipcwd_private.io_addr) != 0xF0) | ||
498 | pcipcwd_private.supports_temp = 1; | ||
499 | } | ||
500 | |||
501 | static int __devinit pcipcwd_card_init(struct pci_dev *pdev, | 635 | static int __devinit pcipcwd_card_init(struct pci_dev *pdev, |
502 | const struct pci_device_id *ent) | 636 | const struct pci_device_id *ent) |
503 | { | 637 | { |
504 | int ret = -EIO; | 638 | int ret = -EIO; |
505 | int got_fw_rev, fw_rev_major, fw_rev_minor; | ||
506 | char fw_ver_str[20]; | ||
507 | char option_switches; | ||
508 | 639 | ||
509 | cards_found++; | 640 | cards_found++; |
510 | if (cards_found == 1) | 641 | if (cards_found == 1) |
@@ -546,36 +677,10 @@ static int __devinit pcipcwd_card_init(struct pci_dev *pdev, | |||
546 | pcipcwd_stop(); | 677 | pcipcwd_stop(); |
547 | 678 | ||
548 | /* Check whether or not the card supports the temperature device */ | 679 | /* Check whether or not the card supports the temperature device */ |
549 | check_temperature_support(); | 680 | pcipcwd_check_temperature_support(); |
550 | |||
551 | /* Get the Firmware Version */ | ||
552 | got_fw_rev = send_command(CMD_GET_FIRMWARE_VERSION, &fw_rev_major, &fw_rev_minor); | ||
553 | if (got_fw_rev) { | ||
554 | sprintf(fw_ver_str, "%u.%02u", fw_rev_major, fw_rev_minor); | ||
555 | } else { | ||
556 | sprintf(fw_ver_str, "<card no answer>"); | ||
557 | } | ||
558 | 681 | ||
559 | /* Get switch settings */ | 682 | /* Show info about the card itself */ |
560 | option_switches = inb_p(pcipcwd_private.io_addr + 3); | 683 | pcipcwd_show_card_info(); |
561 | |||
562 | printk(KERN_INFO PFX "Found card at port 0x%04x (Firmware: %s) %s temp option\n", | ||
563 | (int) pcipcwd_private.io_addr, fw_ver_str, | ||
564 | (pcipcwd_private.supports_temp ? "with" : "without")); | ||
565 | |||
566 | printk(KERN_INFO PFX "Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n", | ||
567 | option_switches, | ||
568 | ((option_switches & 0x10) ? "ON" : "OFF"), | ||
569 | ((option_switches & 0x08) ? "ON" : "OFF")); | ||
570 | |||
571 | if (pcipcwd_private.boot_status & WDIOF_CARDRESET) | ||
572 | printk(KERN_INFO PFX "Previous reset was caused by the Watchdog card\n"); | ||
573 | |||
574 | if (pcipcwd_private.boot_status & WDIOF_OVERHEAT) | ||
575 | printk(KERN_INFO PFX "Card sensed a CPU Overheat\n"); | ||
576 | |||
577 | if (pcipcwd_private.boot_status == 0) | ||
578 | printk(KERN_INFO PFX "No previous trip detected - Cold boot or reset\n"); | ||
579 | 684 | ||
580 | /* Check that the heartbeat value is within it's range ; if not reset to the default */ | 685 | /* Check that the heartbeat value is within it's range ; if not reset to the default */ |
581 | if (pcipcwd_set_heartbeat(heartbeat)) { | 686 | if (pcipcwd_set_heartbeat(heartbeat)) { |
@@ -656,7 +761,7 @@ static struct pci_driver pcipcwd_driver = { | |||
656 | 761 | ||
657 | static int __init pcipcwd_init_module(void) | 762 | static int __init pcipcwd_init_module(void) |
658 | { | 763 | { |
659 | spin_lock_init (&pcipcwd_private.io_lock); | 764 | spin_lock_init(&pcipcwd_private.io_lock); |
660 | 765 | ||
661 | return pci_register_driver(&pcipcwd_driver); | 766 | return pci_register_driver(&pcipcwd_driver); |
662 | } | 767 | } |
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index 1422285d537c..505677fb3157 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c | |||
@@ -69,8 +69,7 @@ int cn_already_initialized = 0; | |||
69 | * a new message. | 69 | * a new message. |
70 | * | 70 | * |
71 | */ | 71 | */ |
72 | int cn_netlink_send(struct cn_msg *msg, u32 __group, | 72 | int cn_netlink_send(struct cn_msg *msg, u32 __group, gfp_t gfp_mask) |
73 | unsigned int __nocast gfp_mask) | ||
74 | { | 73 | { |
75 | struct cn_callback_entry *__cbq; | 74 | struct cn_callback_entry *__cbq; |
76 | unsigned int size; | 75 | unsigned int size; |
diff --git a/drivers/firmware/dell_rbu.c b/drivers/firmware/dell_rbu.c index b66782398258..4f4ba9b6d182 100644 --- a/drivers/firmware/dell_rbu.c +++ b/drivers/firmware/dell_rbu.c | |||
@@ -50,7 +50,7 @@ | |||
50 | MODULE_AUTHOR("Abhay Salunke <abhay_salunke@dell.com>"); | 50 | MODULE_AUTHOR("Abhay Salunke <abhay_salunke@dell.com>"); |
51 | MODULE_DESCRIPTION("Driver for updating BIOS image on DELL systems"); | 51 | MODULE_DESCRIPTION("Driver for updating BIOS image on DELL systems"); |
52 | MODULE_LICENSE("GPL"); | 52 | MODULE_LICENSE("GPL"); |
53 | MODULE_VERSION("2.0"); | 53 | MODULE_VERSION("3.0"); |
54 | 54 | ||
55 | #define BIOS_SCAN_LIMIT 0xffffffff | 55 | #define BIOS_SCAN_LIMIT 0xffffffff |
56 | #define MAX_IMAGE_LENGTH 16 | 56 | #define MAX_IMAGE_LENGTH 16 |
@@ -62,15 +62,16 @@ static struct _rbu_data { | |||
62 | int dma_alloc; | 62 | int dma_alloc; |
63 | spinlock_t lock; | 63 | spinlock_t lock; |
64 | unsigned long packet_read_count; | 64 | unsigned long packet_read_count; |
65 | unsigned long packet_write_count; | ||
66 | unsigned long num_packets; | 65 | unsigned long num_packets; |
67 | unsigned long packetsize; | 66 | unsigned long packetsize; |
67 | unsigned long imagesize; | ||
68 | int entry_created; | 68 | int entry_created; |
69 | } rbu_data; | 69 | } rbu_data; |
70 | 70 | ||
71 | static char image_type[MAX_IMAGE_LENGTH + 1] = "mono"; | 71 | static char image_type[MAX_IMAGE_LENGTH + 1] = "mono"; |
72 | module_param_string(image_type, image_type, sizeof (image_type), 0); | 72 | module_param_string(image_type, image_type, sizeof (image_type), 0); |
73 | MODULE_PARM_DESC(image_type, "BIOS image type. choose- mono or packet"); | 73 | MODULE_PARM_DESC(image_type, |
74 | "BIOS image type. choose- mono or packet or init"); | ||
74 | 75 | ||
75 | struct packet_data { | 76 | struct packet_data { |
76 | struct list_head list; | 77 | struct list_head list; |
@@ -88,55 +89,13 @@ static dma_addr_t dell_rbu_dmaaddr; | |||
88 | static void init_packet_head(void) | 89 | static void init_packet_head(void) |
89 | { | 90 | { |
90 | INIT_LIST_HEAD(&packet_data_head.list); | 91 | INIT_LIST_HEAD(&packet_data_head.list); |
91 | rbu_data.packet_write_count = 0; | ||
92 | rbu_data.packet_read_count = 0; | 92 | rbu_data.packet_read_count = 0; |
93 | rbu_data.num_packets = 0; | 93 | rbu_data.num_packets = 0; |
94 | rbu_data.packetsize = 0; | 94 | rbu_data.packetsize = 0; |
95 | rbu_data.imagesize = 0; | ||
95 | } | 96 | } |
96 | 97 | ||
97 | static int fill_last_packet(void *data, size_t length) | 98 | static int create_packet(void *data, size_t length) |
98 | { | ||
99 | struct list_head *ptemp_list; | ||
100 | struct packet_data *packet = NULL; | ||
101 | int packet_count = 0; | ||
102 | |||
103 | pr_debug("fill_last_packet: entry \n"); | ||
104 | |||
105 | if (!rbu_data.num_packets) { | ||
106 | pr_debug("fill_last_packet: num_packets=0\n"); | ||
107 | return -ENOMEM; | ||
108 | } | ||
109 | |||
110 | packet_count = rbu_data.num_packets; | ||
111 | |||
112 | ptemp_list = (&packet_data_head.list)->prev; | ||
113 | |||
114 | packet = list_entry(ptemp_list, struct packet_data, list); | ||
115 | |||
116 | if ((rbu_data.packet_write_count + length) > rbu_data.packetsize) { | ||
117 | pr_debug("dell_rbu:%s: packet size data " | ||
118 | "overrun\n", __FUNCTION__); | ||
119 | return -EINVAL; | ||
120 | } | ||
121 | |||
122 | pr_debug("fill_last_packet : buffer = %p\n", packet->data); | ||
123 | |||
124 | memcpy((packet->data + rbu_data.packet_write_count), data, length); | ||
125 | |||
126 | if ((rbu_data.packet_write_count + length) == rbu_data.packetsize) { | ||
127 | /* | ||
128 | * this was the last data chunk in the packet | ||
129 | * so reinitialize the packet data counter to zero | ||
130 | */ | ||
131 | rbu_data.packet_write_count = 0; | ||
132 | } else | ||
133 | rbu_data.packet_write_count += length; | ||
134 | |||
135 | pr_debug("fill_last_packet: exit \n"); | ||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | static int create_packet(size_t length) | ||
140 | { | 99 | { |
141 | struct packet_data *newpacket; | 100 | struct packet_data *newpacket; |
142 | int ordernum = 0; | 101 | int ordernum = 0; |
@@ -186,9 +145,11 @@ static int create_packet(size_t length) | |||
186 | INIT_LIST_HEAD(&newpacket->list); | 145 | INIT_LIST_HEAD(&newpacket->list); |
187 | list_add_tail(&newpacket->list, &packet_data_head.list); | 146 | list_add_tail(&newpacket->list, &packet_data_head.list); |
188 | /* | 147 | /* |
189 | * packets have fixed size | 148 | * packets may not have fixed size |
190 | */ | 149 | */ |
191 | newpacket->length = rbu_data.packetsize; | 150 | newpacket->length = length; |
151 | |||
152 | memcpy(newpacket->data, data, length); | ||
192 | 153 | ||
193 | pr_debug("create_packet: exit \n"); | 154 | pr_debug("create_packet: exit \n"); |
194 | 155 | ||
@@ -198,13 +159,37 @@ static int create_packet(size_t length) | |||
198 | static int packetize_data(void *data, size_t length) | 159 | static int packetize_data(void *data, size_t length) |
199 | { | 160 | { |
200 | int rc = 0; | 161 | int rc = 0; |
162 | int done = 0; | ||
163 | int packet_length; | ||
164 | u8 *temp; | ||
165 | u8 *end = (u8 *) data + length; | ||
166 | pr_debug("packetize_data: data length %d\n", length); | ||
167 | if (!rbu_data.packetsize) { | ||
168 | printk(KERN_WARNING | ||
169 | "dell_rbu: packetsize not specified\n"); | ||
170 | return -EIO; | ||
171 | } | ||
201 | 172 | ||
202 | if (!rbu_data.packet_write_count) { | 173 | temp = (u8 *) data; |
203 | if ((rc = create_packet(length))) | 174 | |
175 | /* packetize the hunk */ | ||
176 | while (!done) { | ||
177 | if ((temp + rbu_data.packetsize) < end) | ||
178 | packet_length = rbu_data.packetsize; | ||
179 | else { | ||
180 | /* this is the last packet */ | ||
181 | packet_length = end - temp; | ||
182 | done = 1; | ||
183 | } | ||
184 | |||
185 | if ((rc = create_packet(temp, packet_length))) | ||
204 | return rc; | 186 | return rc; |
187 | |||
188 | pr_debug("%lu:%lu\n", temp, (end - temp)); | ||
189 | temp += packet_length; | ||
205 | } | 190 | } |
206 | if ((rc = fill_last_packet(data, length))) | 191 | |
207 | return rc; | 192 | rbu_data.imagesize = length; |
208 | 193 | ||
209 | return rc; | 194 | return rc; |
210 | } | 195 | } |
@@ -243,7 +228,7 @@ static int do_packet_read(char *data, struct list_head *ptemp_list, | |||
243 | return bytes_copied; | 228 | return bytes_copied; |
244 | } | 229 | } |
245 | 230 | ||
246 | static int packet_read_list(char *data, size_t *pread_length) | 231 | static int packet_read_list(char *data, size_t * pread_length) |
247 | { | 232 | { |
248 | struct list_head *ptemp_list; | 233 | struct list_head *ptemp_list; |
249 | int temp_count = 0; | 234 | int temp_count = 0; |
@@ -303,10 +288,9 @@ static void packet_empty_list(void) | |||
303 | newpacket->ordernum); | 288 | newpacket->ordernum); |
304 | kfree(newpacket); | 289 | kfree(newpacket); |
305 | } | 290 | } |
306 | rbu_data.packet_write_count = 0; | ||
307 | rbu_data.packet_read_count = 0; | 291 | rbu_data.packet_read_count = 0; |
308 | rbu_data.num_packets = 0; | 292 | rbu_data.num_packets = 0; |
309 | rbu_data.packetsize = 0; | 293 | rbu_data.imagesize = 0; |
310 | } | 294 | } |
311 | 295 | ||
312 | /* | 296 | /* |
@@ -425,7 +409,6 @@ static ssize_t read_packet_data(char *buffer, loff_t pos, size_t count) | |||
425 | size_t bytes_left; | 409 | size_t bytes_left; |
426 | size_t data_length; | 410 | size_t data_length; |
427 | char *ptempBuf = buffer; | 411 | char *ptempBuf = buffer; |
428 | unsigned long imagesize; | ||
429 | 412 | ||
430 | /* check to see if we have something to return */ | 413 | /* check to see if we have something to return */ |
431 | if (rbu_data.num_packets == 0) { | 414 | if (rbu_data.num_packets == 0) { |
@@ -434,22 +417,20 @@ static ssize_t read_packet_data(char *buffer, loff_t pos, size_t count) | |||
434 | goto read_rbu_data_exit; | 417 | goto read_rbu_data_exit; |
435 | } | 418 | } |
436 | 419 | ||
437 | imagesize = rbu_data.num_packets * rbu_data.packetsize; | 420 | if (pos > rbu_data.imagesize) { |
438 | |||
439 | if (pos > imagesize) { | ||
440 | retval = 0; | 421 | retval = 0; |
441 | printk(KERN_WARNING "dell_rbu:read_packet_data: " | 422 | printk(KERN_WARNING "dell_rbu:read_packet_data: " |
442 | "data underrun\n"); | 423 | "data underrun\n"); |
443 | goto read_rbu_data_exit; | 424 | goto read_rbu_data_exit; |
444 | } | 425 | } |
445 | 426 | ||
446 | bytes_left = imagesize - pos; | 427 | bytes_left = rbu_data.imagesize - pos; |
447 | data_length = min(bytes_left, count); | 428 | data_length = min(bytes_left, count); |
448 | 429 | ||
449 | if ((retval = packet_read_list(ptempBuf, &data_length)) < 0) | 430 | if ((retval = packet_read_list(ptempBuf, &data_length)) < 0) |
450 | goto read_rbu_data_exit; | 431 | goto read_rbu_data_exit; |
451 | 432 | ||
452 | if ((pos + count) > imagesize) { | 433 | if ((pos + count) > rbu_data.imagesize) { |
453 | rbu_data.packet_read_count = 0; | 434 | rbu_data.packet_read_count = 0; |
454 | /* this was the last copy */ | 435 | /* this was the last copy */ |
455 | retval = bytes_left; | 436 | retval = bytes_left; |
@@ -499,7 +480,7 @@ static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count) | |||
499 | } | 480 | } |
500 | 481 | ||
501 | static ssize_t read_rbu_data(struct kobject *kobj, char *buffer, | 482 | static ssize_t read_rbu_data(struct kobject *kobj, char *buffer, |
502 | loff_t pos, size_t count) | 483 | loff_t pos, size_t count) |
503 | { | 484 | { |
504 | ssize_t ret_count = 0; | 485 | ssize_t ret_count = 0; |
505 | 486 | ||
@@ -531,13 +512,18 @@ static void callbackfn_rbu(const struct firmware *fw, void *context) | |||
531 | memcpy(rbu_data.image_update_buffer, | 512 | memcpy(rbu_data.image_update_buffer, |
532 | fw->data, fw->size); | 513 | fw->data, fw->size); |
533 | } else if (!strcmp(image_type, "packet")) { | 514 | } else if (!strcmp(image_type, "packet")) { |
534 | if (!rbu_data.packetsize) | 515 | /* |
535 | rbu_data.packetsize = fw->size; | 516 | * we need to free previous packets if a |
536 | else if (rbu_data.packetsize != fw->size) { | 517 | * new hunk of packets needs to be downloaded |
518 | */ | ||
519 | packet_empty_list(); | ||
520 | if (packetize_data(fw->data, fw->size)) | ||
521 | /* Incase something goes wrong when we are | ||
522 | * in middle of packetizing the data, we | ||
523 | * need to free up whatever packets might | ||
524 | * have been created before we quit. | ||
525 | */ | ||
537 | packet_empty_list(); | 526 | packet_empty_list(); |
538 | rbu_data.packetsize = fw->size; | ||
539 | } | ||
540 | packetize_data(fw->data, fw->size); | ||
541 | } else | 527 | } else |
542 | pr_debug("invalid image type specified.\n"); | 528 | pr_debug("invalid image type specified.\n"); |
543 | spin_unlock(&rbu_data.lock); | 529 | spin_unlock(&rbu_data.lock); |
@@ -553,7 +539,7 @@ static void callbackfn_rbu(const struct firmware *fw, void *context) | |||
553 | } | 539 | } |
554 | 540 | ||
555 | static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer, | 541 | static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer, |
556 | loff_t pos, size_t count) | 542 | loff_t pos, size_t count) |
557 | { | 543 | { |
558 | int size = 0; | 544 | int size = 0; |
559 | if (!pos) | 545 | if (!pos) |
@@ -562,7 +548,7 @@ static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer, | |||
562 | } | 548 | } |
563 | 549 | ||
564 | static ssize_t write_rbu_image_type(struct kobject *kobj, char *buffer, | 550 | static ssize_t write_rbu_image_type(struct kobject *kobj, char *buffer, |
565 | loff_t pos, size_t count) | 551 | loff_t pos, size_t count) |
566 | { | 552 | { |
567 | int rc = count; | 553 | int rc = count; |
568 | int req_firm_rc = 0; | 554 | int req_firm_rc = 0; |
@@ -621,25 +607,49 @@ static ssize_t write_rbu_image_type(struct kobject *kobj, char *buffer, | |||
621 | return rc; | 607 | return rc; |
622 | } | 608 | } |
623 | 609 | ||
610 | static ssize_t read_rbu_packet_size(struct kobject *kobj, char *buffer, | ||
611 | loff_t pos, size_t count) | ||
612 | { | ||
613 | int size = 0; | ||
614 | if (!pos) { | ||
615 | spin_lock(&rbu_data.lock); | ||
616 | size = sprintf(buffer, "%lu\n", rbu_data.packetsize); | ||
617 | spin_unlock(&rbu_data.lock); | ||
618 | } | ||
619 | return size; | ||
620 | } | ||
621 | |||
622 | static ssize_t write_rbu_packet_size(struct kobject *kobj, char *buffer, | ||
623 | loff_t pos, size_t count) | ||
624 | { | ||
625 | unsigned long temp; | ||
626 | spin_lock(&rbu_data.lock); | ||
627 | packet_empty_list(); | ||
628 | sscanf(buffer, "%lu", &temp); | ||
629 | if (temp < 0xffffffff) | ||
630 | rbu_data.packetsize = temp; | ||
631 | |||
632 | spin_unlock(&rbu_data.lock); | ||
633 | return count; | ||
634 | } | ||
635 | |||
624 | static struct bin_attribute rbu_data_attr = { | 636 | static struct bin_attribute rbu_data_attr = { |
625 | .attr = { | 637 | .attr = {.name = "data",.owner = THIS_MODULE,.mode = 0444}, |
626 | .name = "data", | ||
627 | .owner = THIS_MODULE, | ||
628 | .mode = 0444, | ||
629 | }, | ||
630 | .read = read_rbu_data, | 638 | .read = read_rbu_data, |
631 | }; | 639 | }; |
632 | 640 | ||
633 | static struct bin_attribute rbu_image_type_attr = { | 641 | static struct bin_attribute rbu_image_type_attr = { |
634 | .attr = { | 642 | .attr = {.name = "image_type",.owner = THIS_MODULE,.mode = 0644}, |
635 | .name = "image_type", | ||
636 | .owner = THIS_MODULE, | ||
637 | .mode = 0644, | ||
638 | }, | ||
639 | .read = read_rbu_image_type, | 643 | .read = read_rbu_image_type, |
640 | .write = write_rbu_image_type, | 644 | .write = write_rbu_image_type, |
641 | }; | 645 | }; |
642 | 646 | ||
647 | static struct bin_attribute rbu_packet_size_attr = { | ||
648 | .attr = {.name = "packet_size",.owner = THIS_MODULE,.mode = 0644}, | ||
649 | .read = read_rbu_packet_size, | ||
650 | .write = write_rbu_packet_size, | ||
651 | }; | ||
652 | |||
643 | static int __init dcdrbu_init(void) | 653 | static int __init dcdrbu_init(void) |
644 | { | 654 | { |
645 | int rc = 0; | 655 | int rc = 0; |
@@ -657,6 +667,8 @@ static int __init dcdrbu_init(void) | |||
657 | 667 | ||
658 | sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_data_attr); | 668 | sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_data_attr); |
659 | sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_image_type_attr); | 669 | sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_image_type_attr); |
670 | sysfs_create_bin_file(&rbu_device->dev.kobj, | ||
671 | &rbu_packet_size_attr); | ||
660 | 672 | ||
661 | rc = request_firmware_nowait(THIS_MODULE, FW_ACTION_NOHOTPLUG, | 673 | rc = request_firmware_nowait(THIS_MODULE, FW_ACTION_NOHOTPLUG, |
662 | "dell_rbu", &rbu_device->dev, &context, callbackfn_rbu); | 674 | "dell_rbu", &rbu_device->dev, &context, callbackfn_rbu); |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 9e9cf1407311..5275cbb1afe9 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -1101,6 +1101,7 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq) | |||
1101 | ide_hwif_t *hwif; | 1101 | ide_hwif_t *hwif; |
1102 | struct request *rq; | 1102 | struct request *rq; |
1103 | ide_startstop_t startstop; | 1103 | ide_startstop_t startstop; |
1104 | int loops = 0; | ||
1104 | 1105 | ||
1105 | /* for atari only: POSSIBLY BROKEN HERE(?) */ | 1106 | /* for atari only: POSSIBLY BROKEN HERE(?) */ |
1106 | ide_get_lock(ide_intr, hwgroup); | 1107 | ide_get_lock(ide_intr, hwgroup); |
@@ -1153,6 +1154,7 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq) | |||
1153 | /* no more work for this hwgroup (for now) */ | 1154 | /* no more work for this hwgroup (for now) */ |
1154 | return; | 1155 | return; |
1155 | } | 1156 | } |
1157 | again: | ||
1156 | hwif = HWIF(drive); | 1158 | hwif = HWIF(drive); |
1157 | if (hwgroup->hwif->sharing_irq && | 1159 | if (hwgroup->hwif->sharing_irq && |
1158 | hwif != hwgroup->hwif && | 1160 | hwif != hwgroup->hwif && |
@@ -1192,8 +1194,14 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq) | |||
1192 | * though. I hope that doesn't happen too much, hopefully not | 1194 | * though. I hope that doesn't happen too much, hopefully not |
1193 | * unless the subdriver triggers such a thing in its own PM | 1195 | * unless the subdriver triggers such a thing in its own PM |
1194 | * state machine. | 1196 | * state machine. |
1197 | * | ||
1198 | * We count how many times we loop here to make sure we service | ||
1199 | * all drives in the hwgroup without looping for ever | ||
1195 | */ | 1200 | */ |
1196 | if (drive->blocked && !blk_pm_request(rq) && !(rq->flags & REQ_PREEMPT)) { | 1201 | if (drive->blocked && !blk_pm_request(rq) && !(rq->flags & REQ_PREEMPT)) { |
1202 | drive = drive->next ? drive->next : hwgroup->drive; | ||
1203 | if (loops++ < 4 && !blk_queue_plugged(drive->queue)) | ||
1204 | goto again; | ||
1197 | /* We clear busy, there should be no pending ATA command at this point. */ | 1205 | /* We clear busy, there should be no pending ATA command at this point. */ |
1198 | hwgroup->busy = 0; | 1206 | hwgroup->busy = 0; |
1199 | break; | 1207 | break; |
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c index 5fe4f2ba0979..315f5ca8bedb 100644 --- a/drivers/ieee1394/raw1394.c +++ b/drivers/ieee1394/raw1394.c | |||
@@ -98,7 +98,7 @@ static struct hpsb_address_ops arm_ops = { | |||
98 | 98 | ||
99 | static void queue_complete_cb(struct pending_request *req); | 99 | static void queue_complete_cb(struct pending_request *req); |
100 | 100 | ||
101 | static struct pending_request *__alloc_pending_request(unsigned int __nocast flags) | 101 | static struct pending_request *__alloc_pending_request(gfp_t flags) |
102 | { | 102 | { |
103 | struct pending_request *req; | 103 | struct pending_request *req; |
104 | 104 | ||
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index a4a4d9c1eef3..a14ca87fda18 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c | |||
@@ -783,7 +783,7 @@ struct ib_mad_send_buf * ib_create_send_mad(struct ib_mad_agent *mad_agent, | |||
783 | u32 remote_qpn, u16 pkey_index, | 783 | u32 remote_qpn, u16 pkey_index, |
784 | struct ib_ah *ah, int rmpp_active, | 784 | struct ib_ah *ah, int rmpp_active, |
785 | int hdr_len, int data_len, | 785 | int hdr_len, int data_len, |
786 | unsigned int __nocast gfp_mask) | 786 | gfp_t gfp_mask) |
787 | { | 787 | { |
788 | struct ib_mad_agent_private *mad_agent_priv; | 788 | struct ib_mad_agent_private *mad_agent_priv; |
789 | struct ib_mad_send_buf *send_buf; | 789 | struct ib_mad_send_buf *send_buf; |
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index 78de2dd1a4f2..262618210c1c 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c | |||
@@ -574,7 +574,7 @@ static void ib_sa_path_rec_release(struct ib_sa_query *sa_query) | |||
574 | int ib_sa_path_rec_get(struct ib_device *device, u8 port_num, | 574 | int ib_sa_path_rec_get(struct ib_device *device, u8 port_num, |
575 | struct ib_sa_path_rec *rec, | 575 | struct ib_sa_path_rec *rec, |
576 | ib_sa_comp_mask comp_mask, | 576 | ib_sa_comp_mask comp_mask, |
577 | int timeout_ms, unsigned int __nocast gfp_mask, | 577 | int timeout_ms, gfp_t gfp_mask, |
578 | void (*callback)(int status, | 578 | void (*callback)(int status, |
579 | struct ib_sa_path_rec *resp, | 579 | struct ib_sa_path_rec *resp, |
580 | void *context), | 580 | void *context), |
@@ -676,7 +676,7 @@ static void ib_sa_service_rec_release(struct ib_sa_query *sa_query) | |||
676 | int ib_sa_service_rec_query(struct ib_device *device, u8 port_num, u8 method, | 676 | int ib_sa_service_rec_query(struct ib_device *device, u8 port_num, u8 method, |
677 | struct ib_sa_service_rec *rec, | 677 | struct ib_sa_service_rec *rec, |
678 | ib_sa_comp_mask comp_mask, | 678 | ib_sa_comp_mask comp_mask, |
679 | int timeout_ms, unsigned int __nocast gfp_mask, | 679 | int timeout_ms, gfp_t gfp_mask, |
680 | void (*callback)(int status, | 680 | void (*callback)(int status, |
681 | struct ib_sa_service_rec *resp, | 681 | struct ib_sa_service_rec *resp, |
682 | void *context), | 682 | void *context), |
@@ -759,7 +759,7 @@ int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num, | |||
759 | u8 method, | 759 | u8 method, |
760 | struct ib_sa_mcmember_rec *rec, | 760 | struct ib_sa_mcmember_rec *rec, |
761 | ib_sa_comp_mask comp_mask, | 761 | ib_sa_comp_mask comp_mask, |
762 | int timeout_ms, unsigned int __nocast gfp_mask, | 762 | int timeout_ms, gfp_t gfp_mask, |
763 | void (*callback)(int status, | 763 | void (*callback)(int status, |
764 | struct ib_sa_mcmember_rec *resp, | 764 | struct ib_sa_mcmember_rec *resp, |
765 | void *context), | 765 | void *context), |
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 444f7756fee6..571a68691a4a 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -93,7 +93,7 @@ config KEYBOARD_LKKBD | |||
93 | 93 | ||
94 | config KEYBOARD_LOCOMO | 94 | config KEYBOARD_LOCOMO |
95 | tristate "LoCoMo Keyboard Support" | 95 | tristate "LoCoMo Keyboard Support" |
96 | depends on SHARP_LOCOMO | 96 | depends on SHARP_LOCOMO && INPUT_KEYBOARD |
97 | help | 97 | help |
98 | Say Y here if you are running Linux on a Sharp Zaurus Collie or Poodle based PDA | 98 | Say Y here if you are running Linux on a Sharp Zaurus Collie or Poodle based PDA |
99 | 99 | ||
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c index 1714045a182b..344f46005401 100644 --- a/drivers/input/keyboard/spitzkbd.c +++ b/drivers/input/keyboard/spitzkbd.c | |||
@@ -53,7 +53,7 @@ static unsigned char spitzkbd_keycode[NR_SCANCODES] = { | |||
53 | KEY_LEFTCTRL, KEY_1, KEY_3, KEY_5, KEY_6, KEY_7, KEY_9, KEY_0, KEY_BACKSPACE, SPITZ_KEY_EXOK, SPITZ_KEY_EXCANCEL, 0, 0, 0, 0, 0, /* 1-16 */ | 53 | KEY_LEFTCTRL, KEY_1, KEY_3, KEY_5, KEY_6, KEY_7, KEY_9, KEY_0, KEY_BACKSPACE, SPITZ_KEY_EXOK, SPITZ_KEY_EXCANCEL, 0, 0, 0, 0, 0, /* 1-16 */ |
54 | 0, KEY_2, KEY_4, KEY_R, KEY_Y, KEY_8, KEY_I, KEY_O, KEY_P, SPITZ_KEY_EXJOGDOWN, SPITZ_KEY_EXJOGUP, 0, 0, 0, 0, 0, /* 17-32 */ | 54 | 0, KEY_2, KEY_4, KEY_R, KEY_Y, KEY_8, KEY_I, KEY_O, KEY_P, SPITZ_KEY_EXJOGDOWN, SPITZ_KEY_EXJOGUP, 0, 0, 0, 0, 0, /* 17-32 */ |
55 | KEY_TAB, KEY_Q, KEY_E, KEY_T, KEY_G, KEY_U, KEY_J, KEY_K, 0, 0, 0, 0, 0, 0, 0, 0, /* 33-48 */ | 55 | KEY_TAB, KEY_Q, KEY_E, KEY_T, KEY_G, KEY_U, KEY_J, KEY_K, 0, 0, 0, 0, 0, 0, 0, 0, /* 33-48 */ |
56 | SPITZ_KEY_CALENDER, KEY_W, KEY_S, KEY_F, KEY_V, KEY_H, KEY_M, KEY_L, 0, 0, KEY_RIGHTSHIFT, 0, 0, 0, 0, 0, /* 49-64 */ | 56 | SPITZ_KEY_CALENDER, KEY_W, KEY_S, KEY_F, KEY_V, KEY_H, KEY_M, KEY_L, 0, KEY_RIGHTSHIFT, 0, 0, 0, 0, 0, 0, /* 49-64 */ |
57 | SPITZ_KEY_ADDRESS, KEY_A, KEY_D, KEY_C, KEY_B, KEY_N, KEY_DOT, 0, KEY_ENTER, KEY_LEFTSHIFT, 0, 0, 0, 0, 0, 0, /* 65-80 */ | 57 | SPITZ_KEY_ADDRESS, KEY_A, KEY_D, KEY_C, KEY_B, KEY_N, KEY_DOT, 0, KEY_ENTER, KEY_LEFTSHIFT, 0, 0, 0, 0, 0, 0, /* 65-80 */ |
58 | SPITZ_KEY_MAIL, KEY_Z, KEY_X, KEY_MINUS, KEY_SPACE, KEY_COMMA, 0, KEY_UP, 0, 0, SPITZ_KEY_FN, 0, 0, 0, 0, 0, /* 81-96 */ | 58 | SPITZ_KEY_MAIL, KEY_Z, KEY_X, KEY_MINUS, KEY_SPACE, KEY_COMMA, 0, KEY_UP, 0, 0, SPITZ_KEY_FN, 0, 0, 0, 0, 0, /* 81-96 */ |
59 | KEY_SYSRQ, SPITZ_KEY_JAP1, SPITZ_KEY_JAP2, SPITZ_KEY_CANCEL, SPITZ_KEY_OK, SPITZ_KEY_MENU, KEY_LEFT, KEY_DOWN, KEY_RIGHT, 0, 0, 0, 0, 0, 0, 0 /* 97-112 */ | 59 | KEY_SYSRQ, SPITZ_KEY_JAP1, SPITZ_KEY_JAP2, SPITZ_KEY_CANCEL, SPITZ_KEY_OK, SPITZ_KEY_MENU, KEY_LEFT, KEY_DOWN, KEY_RIGHT, 0, 0, 0, 0, 0, 0, 0 /* 97-112 */ |
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index d5c5b32045af..4015a91f4b6e 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c | |||
@@ -90,11 +90,11 @@ static inline int uinput_request_reserve_slot(struct uinput_device *udev, struct | |||
90 | 90 | ||
91 | static void uinput_request_done(struct uinput_device *udev, struct uinput_request *request) | 91 | static void uinput_request_done(struct uinput_device *udev, struct uinput_request *request) |
92 | { | 92 | { |
93 | complete(&request->done); | ||
94 | |||
95 | /* Mark slot as available */ | 93 | /* Mark slot as available */ |
96 | udev->requests[request->id] = NULL; | 94 | udev->requests[request->id] = NULL; |
97 | wake_up_interruptible(&udev->requests_waitq); | 95 | wake_up_interruptible(&udev->requests_waitq); |
96 | |||
97 | complete(&request->done); | ||
98 | } | 98 | } |
99 | 99 | ||
100 | static int uinput_request_submit(struct input_dev *dev, struct uinput_request *request) | 100 | static int uinput_request_submit(struct input_dev *dev, struct uinput_request *request) |
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index b82bc3150476..b6148f6f7836 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -96,7 +96,7 @@ static kmem_cache_t *_crypt_io_pool; | |||
96 | /* | 96 | /* |
97 | * Mempool alloc and free functions for the page | 97 | * Mempool alloc and free functions for the page |
98 | */ | 98 | */ |
99 | static void *mempool_alloc_page(unsigned int __nocast gfp_mask, void *data) | 99 | static void *mempool_alloc_page(gfp_t gfp_mask, void *data) |
100 | { | 100 | { |
101 | return alloc_page(gfp_mask); | 101 | return alloc_page(gfp_mask); |
102 | } | 102 | } |
diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c index 9de000131a8a..4809b209fbb1 100644 --- a/drivers/md/dm-io.c +++ b/drivers/md/dm-io.c | |||
@@ -32,7 +32,7 @@ struct io { | |||
32 | static unsigned _num_ios; | 32 | static unsigned _num_ios; |
33 | static mempool_t *_io_pool; | 33 | static mempool_t *_io_pool; |
34 | 34 | ||
35 | static void *alloc_io(unsigned int __nocast gfp_mask, void *pool_data) | 35 | static void *alloc_io(gfp_t gfp_mask, void *pool_data) |
36 | { | 36 | { |
37 | return kmalloc(sizeof(struct io), gfp_mask); | 37 | return kmalloc(sizeof(struct io), gfp_mask); |
38 | } | 38 | } |
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index 863282513753..2375709a392c 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
@@ -122,7 +122,7 @@ static inline sector_t region_to_sector(struct region_hash *rh, region_t region) | |||
122 | /* FIXME move this */ | 122 | /* FIXME move this */ |
123 | static void queue_bio(struct mirror_set *ms, struct bio *bio, int rw); | 123 | static void queue_bio(struct mirror_set *ms, struct bio *bio, int rw); |
124 | 124 | ||
125 | static void *region_alloc(unsigned int __nocast gfp_mask, void *pool_data) | 125 | static void *region_alloc(gfp_t gfp_mask, void *pool_data) |
126 | { | 126 | { |
127 | return kmalloc(sizeof(struct region), gfp_mask); | 127 | return kmalloc(sizeof(struct region), gfp_mask); |
128 | } | 128 | } |
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 286342375fb7..1151c3ed3006 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c | |||
@@ -38,7 +38,7 @@ | |||
38 | static mdk_personality_t multipath_personality; | 38 | static mdk_personality_t multipath_personality; |
39 | 39 | ||
40 | 40 | ||
41 | static void *mp_pool_alloc(unsigned int __nocast gfp_flags, void *data) | 41 | static void *mp_pool_alloc(gfp_t gfp_flags, void *data) |
42 | { | 42 | { |
43 | struct multipath_bh *mpb; | 43 | struct multipath_bh *mpb; |
44 | mpb = kmalloc(sizeof(*mpb), gfp_flags); | 44 | mpb = kmalloc(sizeof(*mpb), gfp_flags); |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index a93ca478142a..0e1f148dd41d 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -52,7 +52,7 @@ static mdk_personality_t raid1_personality; | |||
52 | static void unplug_slaves(mddev_t *mddev); | 52 | static void unplug_slaves(mddev_t *mddev); |
53 | 53 | ||
54 | 54 | ||
55 | static void * r1bio_pool_alloc(unsigned int __nocast gfp_flags, void *data) | 55 | static void * r1bio_pool_alloc(gfp_t gfp_flags, void *data) |
56 | { | 56 | { |
57 | struct pool_info *pi = data; | 57 | struct pool_info *pi = data; |
58 | r1bio_t *r1_bio; | 58 | r1bio_t *r1_bio; |
@@ -79,7 +79,7 @@ static void r1bio_pool_free(void *r1_bio, void *data) | |||
79 | #define RESYNC_PAGES ((RESYNC_BLOCK_SIZE + PAGE_SIZE-1) / PAGE_SIZE) | 79 | #define RESYNC_PAGES ((RESYNC_BLOCK_SIZE + PAGE_SIZE-1) / PAGE_SIZE) |
80 | #define RESYNC_WINDOW (2048*1024) | 80 | #define RESYNC_WINDOW (2048*1024) |
81 | 81 | ||
82 | static void * r1buf_pool_alloc(unsigned int __nocast gfp_flags, void *data) | 82 | static void * r1buf_pool_alloc(gfp_t gfp_flags, void *data) |
83 | { | 83 | { |
84 | struct pool_info *pi = data; | 84 | struct pool_info *pi = data; |
85 | struct page *page; | 85 | struct page *page; |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 5bd1e9ec899d..28dd028415e4 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -47,7 +47,7 @@ | |||
47 | 47 | ||
48 | static void unplug_slaves(mddev_t *mddev); | 48 | static void unplug_slaves(mddev_t *mddev); |
49 | 49 | ||
50 | static void * r10bio_pool_alloc(unsigned int __nocast gfp_flags, void *data) | 50 | static void * r10bio_pool_alloc(gfp_t gfp_flags, void *data) |
51 | { | 51 | { |
52 | conf_t *conf = data; | 52 | conf_t *conf = data; |
53 | r10bio_t *r10_bio; | 53 | r10bio_t *r10_bio; |
@@ -81,7 +81,7 @@ static void r10bio_pool_free(void *r10_bio, void *data) | |||
81 | * one for write (we recover only one drive per r10buf) | 81 | * one for write (we recover only one drive per r10buf) |
82 | * | 82 | * |
83 | */ | 83 | */ |
84 | static void * r10buf_pool_alloc(unsigned int __nocast gfp_flags, void *data) | 84 | static void * r10buf_pool_alloc(gfp_t gfp_flags, void *data) |
85 | { | 85 | { |
86 | conf_t *conf = data; | 86 | conf_t *conf = data; |
87 | struct page *page; | 87 | struct page *page; |
diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c index 022913da8c59..9b0406318f2d 100644 --- a/drivers/media/radio/radio-cadet.c +++ b/drivers/media/radio/radio-cadet.c | |||
@@ -543,7 +543,7 @@ static int cadet_probe(void) | |||
543 | 543 | ||
544 | for(i=0;i<8;i++) { | 544 | for(i=0;i<8;i++) { |
545 | io=iovals[i]; | 545 | io=iovals[i]; |
546 | if(request_region(io,2, "cadet-probe")>=0) { | 546 | if (request_region(io, 2, "cadet-probe")) { |
547 | cadet_setfreq(1410); | 547 | cadet_setfreq(1410); |
548 | if(cadet_getfreq()==1410) { | 548 | if(cadet_getfreq()==1410) { |
549 | release_region(io, 2); | 549 | release_region(io, 2); |
diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index 6c332800d6ab..0881a17d5226 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c | |||
@@ -2393,10 +2393,10 @@ struct tvcard bttv_tvcards[] = { | |||
2393 | .tuner = 0, | 2393 | .tuner = 0, |
2394 | .tuner_type = TUNER_LG_TDVS_H062F, | 2394 | .tuner_type = TUNER_LG_TDVS_H062F, |
2395 | .tuner_addr = ADDR_UNSET, | 2395 | .tuner_addr = ADDR_UNSET, |
2396 | .video_inputs = 2, | 2396 | .video_inputs = 3, |
2397 | .audio_inputs = 1, | 2397 | .audio_inputs = 1, |
2398 | .svhs = 2, | 2398 | .svhs = 2, |
2399 | .muxsel = { 2, 3 }, | 2399 | .muxsel = { 2, 3, 1 }, |
2400 | .gpiomask = 0x00e00007, | 2400 | .gpiomask = 0x00e00007, |
2401 | .audiomux = { 0x00400005, 0, 0x00000001, 0, 0x00c00007, 0 }, | 2401 | .audiomux = { 0x00400005, 0, 0x00000001, 0, 0x00c00007, 0 }, |
2402 | .no_msp34xx = 1, | 2402 | .no_msp34xx = 1, |
diff --git a/drivers/media/video/vpx3220.c b/drivers/media/video/vpx3220.c index 4437bdebe24f..137b58f2c666 100644 --- a/drivers/media/video/vpx3220.c +++ b/drivers/media/video/vpx3220.c | |||
@@ -203,7 +203,7 @@ static const unsigned short init_ntsc[] = { | |||
203 | 0x8c, 640, /* Horizontal length */ | 203 | 0x8c, 640, /* Horizontal length */ |
204 | 0x8d, 640, /* Number of pixels */ | 204 | 0x8d, 640, /* Number of pixels */ |
205 | 0x8f, 0xc00, /* Disable window 2 */ | 205 | 0x8f, 0xc00, /* Disable window 2 */ |
206 | 0xf0, 0x173, /* 13.5 MHz transport, Forced | 206 | 0xf0, 0x73, /* 13.5 MHz transport, Forced |
207 | * mode, latch windows */ | 207 | * mode, latch windows */ |
208 | 0xf2, 0x13, /* NTSC M, composite input */ | 208 | 0xf2, 0x13, /* NTSC M, composite input */ |
209 | 0xe7, 0x1e1, /* Enable vertical standard | 209 | 0xe7, 0x1e1, /* Enable vertical standard |
@@ -212,38 +212,36 @@ static const unsigned short init_ntsc[] = { | |||
212 | 212 | ||
213 | static const unsigned short init_pal[] = { | 213 | static const unsigned short init_pal[] = { |
214 | 0x88, 23, /* Window 1 vertical begin */ | 214 | 0x88, 23, /* Window 1 vertical begin */ |
215 | 0x89, 288 + 16, /* Vertical lines in (16 lines | 215 | 0x89, 288, /* Vertical lines in (16 lines |
216 | * skipped by the VFE) */ | 216 | * skipped by the VFE) */ |
217 | 0x8a, 288 + 16, /* Vertical lines out (16 lines | 217 | 0x8a, 288, /* Vertical lines out (16 lines |
218 | * skipped by the VFE) */ | 218 | * skipped by the VFE) */ |
219 | 0x8b, 16, /* Horizontal begin */ | 219 | 0x8b, 16, /* Horizontal begin */ |
220 | 0x8c, 768, /* Horizontal length */ | 220 | 0x8c, 768, /* Horizontal length */ |
221 | 0x8d, 784, /* Number of pixels | 221 | 0x8d, 784, /* Number of pixels |
222 | * Must be >= Horizontal begin + Horizontal length */ | 222 | * Must be >= Horizontal begin + Horizontal length */ |
223 | 0x8f, 0xc00, /* Disable window 2 */ | 223 | 0x8f, 0xc00, /* Disable window 2 */ |
224 | 0xf0, 0x177, /* 13.5 MHz transport, Forced | 224 | 0xf0, 0x77, /* 13.5 MHz transport, Forced |
225 | * mode, latch windows */ | 225 | * mode, latch windows */ |
226 | 0xf2, 0x3d1, /* PAL B,G,H,I, composite input */ | 226 | 0xf2, 0x3d1, /* PAL B,G,H,I, composite input */ |
227 | 0xe7, 0x261, /* PAL/SECAM set to 288 + 16 lines | 227 | 0xe7, 0x241, /* PAL/SECAM set to 288 lines */ |
228 | * change to 0x241 for 288 lines */ | ||
229 | }; | 228 | }; |
230 | 229 | ||
231 | static const unsigned short init_secam[] = { | 230 | static const unsigned short init_secam[] = { |
232 | 0x88, 23 - 16, /* Window 1 vertical begin */ | 231 | 0x88, 23, /* Window 1 vertical begin */ |
233 | 0x89, 288 + 16, /* Vertical lines in (16 lines | 232 | 0x89, 288, /* Vertical lines in (16 lines |
234 | * skipped by the VFE) */ | 233 | * skipped by the VFE) */ |
235 | 0x8a, 288 + 16, /* Vertical lines out (16 lines | 234 | 0x8a, 288, /* Vertical lines out (16 lines |
236 | * skipped by the VFE) */ | 235 | * skipped by the VFE) */ |
237 | 0x8b, 16, /* Horizontal begin */ | 236 | 0x8b, 16, /* Horizontal begin */ |
238 | 0x8c, 768, /* Horizontal length */ | 237 | 0x8c, 768, /* Horizontal length */ |
239 | 0x8d, 784, /* Number of pixels | 238 | 0x8d, 784, /* Number of pixels |
240 | * Must be >= Horizontal begin + Horizontal length */ | 239 | * Must be >= Horizontal begin + Horizontal length */ |
241 | 0x8f, 0xc00, /* Disable window 2 */ | 240 | 0x8f, 0xc00, /* Disable window 2 */ |
242 | 0xf0, 0x177, /* 13.5 MHz transport, Forced | 241 | 0xf0, 0x77, /* 13.5 MHz transport, Forced |
243 | * mode, latch windows */ | 242 | * mode, latch windows */ |
244 | 0xf2, 0x3d5, /* SECAM, composite input */ | 243 | 0xf2, 0x3d5, /* SECAM, composite input */ |
245 | 0xe7, 0x261, /* PAL/SECAM set to 288 + 16 lines | 244 | 0xe7, 0x241, /* PAL/SECAM set to 288 lines */ |
246 | * change to 0x241 for 288 lines */ | ||
247 | }; | 245 | }; |
248 | 246 | ||
249 | static const unsigned char init_common[] = { | 247 | static const unsigned char init_common[] = { |
@@ -410,6 +408,12 @@ vpx3220_command (struct i2c_client *client, | |||
410 | case DECODER_SET_NORM: | 408 | case DECODER_SET_NORM: |
411 | { | 409 | { |
412 | int *iarg = arg, data; | 410 | int *iarg = arg, data; |
411 | int temp_input; | ||
412 | |||
413 | /* Here we back up the input selection because it gets | ||
414 | overwritten when we fill the registers with the | ||
415 | choosen video norm */ | ||
416 | temp_input = vpx3220_fp_read(client, 0xf2); | ||
413 | 417 | ||
414 | dprintk(1, KERN_DEBUG "%s: DECODER_SET_NORM %d\n", | 418 | dprintk(1, KERN_DEBUG "%s: DECODER_SET_NORM %d\n", |
415 | I2C_NAME(client), *iarg); | 419 | I2C_NAME(client), *iarg); |
@@ -449,6 +453,10 @@ vpx3220_command (struct i2c_client *client, | |||
449 | 453 | ||
450 | } | 454 | } |
451 | decoder->norm = *iarg; | 455 | decoder->norm = *iarg; |
456 | |||
457 | /* And here we set the backed up video input again */ | ||
458 | vpx3220_fp_write(client, 0xf2, temp_input | 0x0010); | ||
459 | udelay(10); | ||
452 | } | 460 | } |
453 | break; | 461 | break; |
454 | 462 | ||
diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c index 612564ac6f7b..e335d54c4659 100644 --- a/drivers/mfd/ucb1x00-core.c +++ b/drivers/mfd/ucb1x00-core.c | |||
@@ -457,6 +457,17 @@ static int ucb1x00_detect_irq(struct ucb1x00 *ucb) | |||
457 | return probe_irq_off(mask); | 457 | return probe_irq_off(mask); |
458 | } | 458 | } |
459 | 459 | ||
460 | static void ucb1x00_release(struct class_device *dev) | ||
461 | { | ||
462 | struct ucb1x00 *ucb = classdev_to_ucb1x00(dev); | ||
463 | kfree(ucb); | ||
464 | } | ||
465 | |||
466 | static struct class ucb1x00_class = { | ||
467 | .name = "ucb1x00", | ||
468 | .release = ucb1x00_release, | ||
469 | }; | ||
470 | |||
460 | static int ucb1x00_probe(struct mcp *mcp) | 471 | static int ucb1x00_probe(struct mcp *mcp) |
461 | { | 472 | { |
462 | struct ucb1x00 *ucb; | 473 | struct ucb1x00 *ucb; |
@@ -546,17 +557,6 @@ static void ucb1x00_remove(struct mcp *mcp) | |||
546 | class_device_unregister(&ucb->cdev); | 557 | class_device_unregister(&ucb->cdev); |
547 | } | 558 | } |
548 | 559 | ||
549 | static void ucb1x00_release(struct class_device *dev) | ||
550 | { | ||
551 | struct ucb1x00 *ucb = classdev_to_ucb1x00(dev); | ||
552 | kfree(ucb); | ||
553 | } | ||
554 | |||
555 | static struct class ucb1x00_class = { | ||
556 | .name = "ucb1x00", | ||
557 | .release = ucb1x00_release, | ||
558 | }; | ||
559 | |||
560 | int ucb1x00_register_driver(struct ucb1x00_driver *drv) | 560 | int ucb1x00_register_driver(struct ucb1x00_driver *drv) |
561 | { | 561 | { |
562 | struct ucb1x00 *ucb; | 562 | struct ucb1x00 *ucb; |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index f0a5b772a386..f264ff162979 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1290,7 +1290,7 @@ static void bond_mc_list_destroy(struct bonding *bond) | |||
1290 | * Copy all the Multicast addresses from src to the bonding device dst | 1290 | * Copy all the Multicast addresses from src to the bonding device dst |
1291 | */ | 1291 | */ |
1292 | static int bond_mc_list_copy(struct dev_mc_list *mc_list, struct bonding *bond, | 1292 | static int bond_mc_list_copy(struct dev_mc_list *mc_list, struct bonding *bond, |
1293 | unsigned int __nocast gfp_flag) | 1293 | gfp_t gfp_flag) |
1294 | { | 1294 | { |
1295 | struct dev_mc_list *dmi, *new_dmi; | 1295 | struct dev_mc_list *dmi, *new_dmi; |
1296 | 1296 | ||
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index fbf1c06ec5c1..40887f09b681 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -903,8 +903,8 @@ static void mdio_write(struct net_device *netdev, int addr, int reg, int data) | |||
903 | 903 | ||
904 | static void e100_get_defaults(struct nic *nic) | 904 | static void e100_get_defaults(struct nic *nic) |
905 | { | 905 | { |
906 | struct param_range rfds = { .min = 16, .max = 256, .count = 256 }; | 906 | struct param_range rfds = { .min = 16, .max = 256, .count = 64 }; |
907 | struct param_range cbs = { .min = 64, .max = 256, .count = 128 }; | 907 | struct param_range cbs = { .min = 64, .max = 256, .count = 64 }; |
908 | 908 | ||
909 | pci_read_config_byte(nic->pdev, PCI_REVISION_ID, &nic->rev_id); | 909 | pci_read_config_byte(nic->pdev, PCI_REVISION_ID, &nic->rev_id); |
910 | /* MAC type is encoded as rev ID; exception: ICH is treated as 82559 */ | 910 | /* MAC type is encoded as rev ID; exception: ICH is treated as 82559 */ |
@@ -1007,213 +1007,25 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) | |||
1007 | c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23]); | 1007 | c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23]); |
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | /********************************************************/ | ||
1011 | /* Micro code for 8086:1229 Rev 8 */ | ||
1012 | /********************************************************/ | ||
1013 | |||
1014 | /* Parameter values for the D101M B-step */ | ||
1015 | #define D101M_CPUSAVER_TIMER_DWORD 78 | ||
1016 | #define D101M_CPUSAVER_BUNDLE_DWORD 65 | ||
1017 | #define D101M_CPUSAVER_MIN_SIZE_DWORD 126 | ||
1018 | |||
1019 | #define D101M_B_RCVBUNDLE_UCODE \ | ||
1020 | {\ | ||
1021 | 0x00550215, 0xFFFF0437, 0xFFFFFFFF, 0x06A70789, 0xFFFFFFFF, 0x0558FFFF, \ | ||
1022 | 0x000C0001, 0x00101312, 0x000C0008, 0x00380216, \ | ||
1023 | 0x0010009C, 0x00204056, 0x002380CC, 0x00380056, \ | ||
1024 | 0x0010009C, 0x00244C0B, 0x00000800, 0x00124818, \ | ||
1025 | 0x00380438, 0x00000000, 0x00140000, 0x00380555, \ | ||
1026 | 0x00308000, 0x00100662, 0x00100561, 0x000E0408, \ | ||
1027 | 0x00134861, 0x000C0002, 0x00103093, 0x00308000, \ | ||
1028 | 0x00100624, 0x00100561, 0x000E0408, 0x00100861, \ | ||
1029 | 0x000C007E, 0x00222C21, 0x000C0002, 0x00103093, \ | ||
1030 | 0x00380C7A, 0x00080000, 0x00103090, 0x00380C7A, \ | ||
1031 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1032 | 0x0010009C, 0x00244C2D, 0x00010004, 0x00041000, \ | ||
1033 | 0x003A0437, 0x00044010, 0x0038078A, 0x00000000, \ | ||
1034 | 0x00100099, 0x00206C7A, 0x0010009C, 0x00244C48, \ | ||
1035 | 0x00130824, 0x000C0001, 0x00101213, 0x00260C75, \ | ||
1036 | 0x00041000, 0x00010004, 0x00130826, 0x000C0006, \ | ||
1037 | 0x002206A8, 0x0013C926, 0x00101313, 0x003806A8, \ | ||
1038 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1039 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1040 | 0x00080600, 0x00101B10, 0x00050004, 0x00100826, \ | ||
1041 | 0x00101210, 0x00380C34, 0x00000000, 0x00000000, \ | ||
1042 | 0x0021155B, 0x00100099, 0x00206559, 0x0010009C, \ | ||
1043 | 0x00244559, 0x00130836, 0x000C0000, 0x00220C62, \ | ||
1044 | 0x000C0001, 0x00101B13, 0x00229C0E, 0x00210C0E, \ | ||
1045 | 0x00226C0E, 0x00216C0E, 0x0022FC0E, 0x00215C0E, \ | ||
1046 | 0x00214C0E, 0x00380555, 0x00010004, 0x00041000, \ | ||
1047 | 0x00278C67, 0x00040800, 0x00018100, 0x003A0437, \ | ||
1048 | 0x00130826, 0x000C0001, 0x00220559, 0x00101313, \ | ||
1049 | 0x00380559, 0x00000000, 0x00000000, 0x00000000, \ | ||
1050 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1051 | 0x00000000, 0x00130831, 0x0010090B, 0x00124813, \ | ||
1052 | 0x000CFF80, 0x002606AB, 0x00041000, 0x00010004, \ | ||
1053 | 0x003806A8, 0x00000000, 0x00000000, 0x00000000, \ | ||
1054 | } | ||
1055 | |||
1056 | /********************************************************/ | ||
1057 | /* Micro code for 8086:1229 Rev 9 */ | ||
1058 | /********************************************************/ | ||
1059 | |||
1060 | /* Parameter values for the D101S */ | ||
1061 | #define D101S_CPUSAVER_TIMER_DWORD 78 | ||
1062 | #define D101S_CPUSAVER_BUNDLE_DWORD 67 | ||
1063 | #define D101S_CPUSAVER_MIN_SIZE_DWORD 128 | ||
1064 | |||
1065 | #define D101S_RCVBUNDLE_UCODE \ | ||
1066 | {\ | ||
1067 | 0x00550242, 0xFFFF047E, 0xFFFFFFFF, 0x06FF0818, 0xFFFFFFFF, 0x05A6FFFF, \ | ||
1068 | 0x000C0001, 0x00101312, 0x000C0008, 0x00380243, \ | ||
1069 | 0x0010009C, 0x00204056, 0x002380D0, 0x00380056, \ | ||
1070 | 0x0010009C, 0x00244F8B, 0x00000800, 0x00124818, \ | ||
1071 | 0x0038047F, 0x00000000, 0x00140000, 0x003805A3, \ | ||
1072 | 0x00308000, 0x00100610, 0x00100561, 0x000E0408, \ | ||
1073 | 0x00134861, 0x000C0002, 0x00103093, 0x00308000, \ | ||
1074 | 0x00100624, 0x00100561, 0x000E0408, 0x00100861, \ | ||
1075 | 0x000C007E, 0x00222FA1, 0x000C0002, 0x00103093, \ | ||
1076 | 0x00380F90, 0x00080000, 0x00103090, 0x00380F90, \ | ||
1077 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1078 | 0x0010009C, 0x00244FAD, 0x00010004, 0x00041000, \ | ||
1079 | 0x003A047E, 0x00044010, 0x00380819, 0x00000000, \ | ||
1080 | 0x00100099, 0x00206FFD, 0x0010009A, 0x0020AFFD, \ | ||
1081 | 0x0010009C, 0x00244FC8, 0x00130824, 0x000C0001, \ | ||
1082 | 0x00101213, 0x00260FF7, 0x00041000, 0x00010004, \ | ||
1083 | 0x00130826, 0x000C0006, 0x00220700, 0x0013C926, \ | ||
1084 | 0x00101313, 0x00380700, 0x00000000, 0x00000000, \ | ||
1085 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1086 | 0x00080600, 0x00101B10, 0x00050004, 0x00100826, \ | ||
1087 | 0x00101210, 0x00380FB6, 0x00000000, 0x00000000, \ | ||
1088 | 0x002115A9, 0x00100099, 0x002065A7, 0x0010009A, \ | ||
1089 | 0x0020A5A7, 0x0010009C, 0x002445A7, 0x00130836, \ | ||
1090 | 0x000C0000, 0x00220FE4, 0x000C0001, 0x00101B13, \ | ||
1091 | 0x00229F8E, 0x00210F8E, 0x00226F8E, 0x00216F8E, \ | ||
1092 | 0x0022FF8E, 0x00215F8E, 0x00214F8E, 0x003805A3, \ | ||
1093 | 0x00010004, 0x00041000, 0x00278FE9, 0x00040800, \ | ||
1094 | 0x00018100, 0x003A047E, 0x00130826, 0x000C0001, \ | ||
1095 | 0x002205A7, 0x00101313, 0x003805A7, 0x00000000, \ | ||
1096 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1097 | 0x00000000, 0x00000000, 0x00000000, 0x00130831, \ | ||
1098 | 0x0010090B, 0x00124813, 0x000CFF80, 0x00260703, \ | ||
1099 | 0x00041000, 0x00010004, 0x00380700 \ | ||
1100 | } | ||
1101 | |||
1102 | /********************************************************/ | ||
1103 | /* Micro code for the 8086:1229 Rev F/10 */ | ||
1104 | /********************************************************/ | ||
1105 | |||
1106 | /* Parameter values for the D102 E-step */ | ||
1107 | #define D102_E_CPUSAVER_TIMER_DWORD 42 | ||
1108 | #define D102_E_CPUSAVER_BUNDLE_DWORD 54 | ||
1109 | #define D102_E_CPUSAVER_MIN_SIZE_DWORD 46 | ||
1110 | |||
1111 | #define D102_E_RCVBUNDLE_UCODE \ | ||
1112 | {\ | ||
1113 | 0x007D028F, 0x0E4204F9, 0x14ED0C85, 0x14FA14E9, 0x0EF70E36, 0x1FFF1FFF, \ | ||
1114 | 0x00E014B9, 0x00000000, 0x00000000, 0x00000000, \ | ||
1115 | 0x00E014BD, 0x00000000, 0x00000000, 0x00000000, \ | ||
1116 | 0x00E014D5, 0x00000000, 0x00000000, 0x00000000, \ | ||
1117 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1118 | 0x00E014C1, 0x00000000, 0x00000000, 0x00000000, \ | ||
1119 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1120 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1121 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1122 | 0x00E014C8, 0x00000000, 0x00000000, 0x00000000, \ | ||
1123 | 0x00200600, 0x00E014EE, 0x00000000, 0x00000000, \ | ||
1124 | 0x0030FF80, 0x00940E46, 0x00038200, 0x00102000, \ | ||
1125 | 0x00E00E43, 0x00000000, 0x00000000, 0x00000000, \ | ||
1126 | 0x00300006, 0x00E014FB, 0x00000000, 0x00000000, \ | ||
1127 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1128 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1129 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1130 | 0x00906E41, 0x00800E3C, 0x00E00E39, 0x00000000, \ | ||
1131 | 0x00906EFD, 0x00900EFD, 0x00E00EF8, 0x00000000, \ | ||
1132 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1133 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1134 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1135 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1136 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1137 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1138 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1139 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1140 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1141 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1142 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1143 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1144 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1145 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1146 | } | ||
1147 | |||
1148 | static void e100_load_ucode(struct nic *nic, struct cb *cb, struct sk_buff *skb) | 1010 | static void e100_load_ucode(struct nic *nic, struct cb *cb, struct sk_buff *skb) |
1149 | { | 1011 | { |
1150 | /* *INDENT-OFF* */ | 1012 | int i; |
1151 | static struct { | 1013 | static const u32 ucode[UCODE_SIZE] = { |
1152 | u32 ucode[UCODE_SIZE + 1]; | 1014 | /* NFS packets are misinterpreted as TCO packets and |
1153 | u8 mac; | 1015 | * incorrectly routed to the BMC over SMBus. This |
1154 | u8 timer_dword; | 1016 | * microcode patch checks the fragmented IP bit in the |
1155 | u8 bundle_dword; | 1017 | * NFS/UDP header to distinguish between NFS and TCO. */ |
1156 | u8 min_size_dword; | 1018 | 0x0EF70E36, 0x1FFF1FFF, 0x1FFF1FFF, 0x1FFF1FFF, 0x1FFF1FFF, |
1157 | } ucode_opts[] = { | 1019 | 0x1FFF1FFF, 0x00906E41, 0x00800E3C, 0x00E00E39, 0x00000000, |
1158 | { D101M_B_RCVBUNDLE_UCODE, | 1020 | 0x00906EFD, 0x00900EFD, 0x00E00EF8, |
1159 | mac_82559_D101M, | 1021 | }; |
1160 | D101M_CPUSAVER_TIMER_DWORD, | ||
1161 | D101M_CPUSAVER_BUNDLE_DWORD, | ||
1162 | D101M_CPUSAVER_MIN_SIZE_DWORD }, | ||
1163 | { D101S_RCVBUNDLE_UCODE, | ||
1164 | mac_82559_D101S, | ||
1165 | D101S_CPUSAVER_TIMER_DWORD, | ||
1166 | D101S_CPUSAVER_BUNDLE_DWORD, | ||
1167 | D101S_CPUSAVER_MIN_SIZE_DWORD }, | ||
1168 | { D102_E_RCVBUNDLE_UCODE, | ||
1169 | mac_82551_F, | ||
1170 | D102_E_CPUSAVER_TIMER_DWORD, | ||
1171 | D102_E_CPUSAVER_BUNDLE_DWORD, | ||
1172 | D102_E_CPUSAVER_MIN_SIZE_DWORD }, | ||
1173 | { D102_E_RCVBUNDLE_UCODE, | ||
1174 | mac_82551_10, | ||
1175 | D102_E_CPUSAVER_TIMER_DWORD, | ||
1176 | D102_E_CPUSAVER_BUNDLE_DWORD, | ||
1177 | D102_E_CPUSAVER_MIN_SIZE_DWORD }, | ||
1178 | { {0}, 0, 0, 0, 0} | ||
1179 | }, *opts; | ||
1180 | /* *INDENT-ON* */ | ||
1181 | |||
1182 | #define BUNDLESMALL 1 | ||
1183 | #define BUNDLEMAX 50 | ||
1184 | #define INTDELAY 15000 | ||
1185 | |||
1186 | opts = ucode_opts; | ||
1187 | |||
1188 | /* do not load u-code for ICH devices */ | ||
1189 | if (nic->flags & ich) | ||
1190 | return; | ||
1191 | |||
1192 | /* Search for ucode match against h/w rev_id */ | ||
1193 | while (opts->mac) { | ||
1194 | if (nic->mac == opts->mac) { | ||
1195 | int i; | ||
1196 | u32 *ucode = opts->ucode; | ||
1197 | |||
1198 | /* Insert user-tunable settings */ | ||
1199 | ucode[opts->timer_dword] &= 0xFFFF0000; | ||
1200 | ucode[opts->timer_dword] |= | ||
1201 | (u16) INTDELAY; | ||
1202 | ucode[opts->bundle_dword] &= 0xFFFF0000; | ||
1203 | ucode[opts->bundle_dword] |= (u16) BUNDLEMAX; | ||
1204 | ucode[opts->min_size_dword] &= 0xFFFF0000; | ||
1205 | ucode[opts->min_size_dword] |= | ||
1206 | (BUNDLESMALL) ? 0xFFFF : 0xFF80; | ||
1207 | |||
1208 | for(i = 0; i < UCODE_SIZE; i++) | ||
1209 | cb->u.ucode[i] = cpu_to_le32(ucode[i]); | ||
1210 | cb->command = cpu_to_le16(cb_ucode); | ||
1211 | return; | ||
1212 | } | ||
1213 | opts++; | ||
1214 | } | ||
1215 | 1022 | ||
1216 | cb->command = cpu_to_le16(cb_nop); | 1023 | if(nic->mac == mac_82551_F || nic->mac == mac_82551_10) { |
1024 | for(i = 0; i < UCODE_SIZE; i++) | ||
1025 | cb->u.ucode[i] = cpu_to_le32(ucode[i]); | ||
1026 | cb->command = cpu_to_le16(cb_ucode); | ||
1027 | } else | ||
1028 | cb->command = cpu_to_le16(cb_nop); | ||
1217 | } | 1029 | } |
1218 | 1030 | ||
1219 | static void e100_setup_iaaddr(struct nic *nic, struct cb *cb, | 1031 | static void e100_setup_iaaddr(struct nic *nic, struct cb *cb, |
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c index 83334db2921c..e4811b42a6b7 100644 --- a/drivers/net/ns83820.c +++ b/drivers/net/ns83820.c | |||
@@ -584,7 +584,7 @@ static inline int ns83820_add_rx_skb(struct ns83820 *dev, struct sk_buff *skb) | |||
584 | return 0; | 584 | return 0; |
585 | } | 585 | } |
586 | 586 | ||
587 | static inline int rx_refill(struct net_device *ndev, unsigned int __nocast gfp) | 587 | static inline int rx_refill(struct net_device *ndev, gfp_t gfp) |
588 | { | 588 | { |
589 | struct ns83820 *dev = PRIV(ndev); | 589 | struct ns83820 *dev = PRIV(ndev); |
590 | unsigned i; | 590 | unsigned i; |
diff --git a/drivers/net/sungem.h b/drivers/net/sungem.h index 16edbb1a4a7a..13006d759ad8 100644 --- a/drivers/net/sungem.h +++ b/drivers/net/sungem.h | |||
@@ -1036,7 +1036,7 @@ struct gem { | |||
1036 | #define ALIGNED_RX_SKB_ADDR(addr) \ | 1036 | #define ALIGNED_RX_SKB_ADDR(addr) \ |
1037 | ((((unsigned long)(addr) + (64UL - 1UL)) & ~(64UL - 1UL)) - (unsigned long)(addr)) | 1037 | ((((unsigned long)(addr) + (64UL - 1UL)) & ~(64UL - 1UL)) - (unsigned long)(addr)) |
1038 | static __inline__ struct sk_buff *gem_alloc_skb(int size, | 1038 | static __inline__ struct sk_buff *gem_alloc_skb(int size, |
1039 | unsigned int __nocast gfp_flags) | 1039 | gfp_t gfp_flags) |
1040 | { | 1040 | { |
1041 | struct sk_buff *skb = alloc_skb(size + 64, gfp_flags); | 1041 | struct sk_buff *skb = alloc_skb(size + 64, gfp_flags); |
1042 | 1042 | ||
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index 00a07f32a81e..7187958e40ca 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig | |||
@@ -243,7 +243,7 @@ config IPW_DEBUG | |||
243 | 243 | ||
244 | config AIRO | 244 | config AIRO |
245 | tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards" | 245 | tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards" |
246 | depends on NET_RADIO && ISA && (PCI || BROKEN) | 246 | depends on NET_RADIO && ISA_DMA_API && (PCI || BROKEN) |
247 | ---help--- | 247 | ---help--- |
248 | This is the standard Linux driver to support Cisco/Aironet ISA and | 248 | This is the standard Linux driver to support Cisco/Aironet ISA and |
249 | PCI 802.11 wireless cards. | 249 | PCI 802.11 wireless cards. |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 11ca44387cb0..a6a630a950d0 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -1233,7 +1233,7 @@ static void __init quirk_alder_ioapic(struct pci_dev *pdev) | |||
1233 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic ); | 1233 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic ); |
1234 | #endif | 1234 | #endif |
1235 | 1235 | ||
1236 | #ifdef CONFIG_SCSI_SATA | 1236 | #ifdef CONFIG_SCSI_SATA_INTEL_COMBINED |
1237 | static void __devinit quirk_intel_ide_combined(struct pci_dev *pdev) | 1237 | static void __devinit quirk_intel_ide_combined(struct pci_dev *pdev) |
1238 | { | 1238 | { |
1239 | u8 prog, comb, tmp; | 1239 | u8 prog, comb, tmp; |
@@ -1310,7 +1310,7 @@ static void __devinit quirk_intel_ide_combined(struct pci_dev *pdev) | |||
1310 | request_region(0x170, 8, "libata"); /* port 1 */ | 1310 | request_region(0x170, 8, "libata"); /* port 1 */ |
1311 | } | 1311 | } |
1312 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_intel_ide_combined ); | 1312 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_intel_ide_combined ); |
1313 | #endif /* CONFIG_SCSI_SATA */ | 1313 | #endif /* CONFIG_SCSI_SATA_INTEL_COMBINED */ |
1314 | 1314 | ||
1315 | 1315 | ||
1316 | int pcie_mch_quirk; | 1316 | int pcie_mch_quirk; |
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index fabd3529cebc..d5e76423a0ee 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c | |||
@@ -689,6 +689,9 @@ static int pccardd(void *__skt) | |||
689 | schedule(); | 689 | schedule(); |
690 | try_to_freeze(); | 690 | try_to_freeze(); |
691 | } | 691 | } |
692 | /* make sure we are running before we exit */ | ||
693 | set_current_state(TASK_RUNNING); | ||
694 | |||
692 | remove_wait_queue(&skt->thread_wait, &wait); | 695 | remove_wait_queue(&skt->thread_wait, &wait); |
693 | 696 | ||
694 | /* remove from the device core */ | 697 | /* remove from the device core */ |
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index 888b70e6a484..9e7ccd8a4321 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c | |||
@@ -66,7 +66,7 @@ void soc_pcmcia_debug(struct soc_pcmcia_socket *skt, const char *func, | |||
66 | if (pc_debug > lvl) { | 66 | if (pc_debug > lvl) { |
67 | printk(KERN_DEBUG "skt%u: %s: ", skt->nr, func); | 67 | printk(KERN_DEBUG "skt%u: %s: ", skt->nr, func); |
68 | va_start(args, fmt); | 68 | va_start(args, fmt); |
69 | printk(fmt, args); | 69 | vprintk(fmt, args); |
70 | va_end(args); | 70 | va_end(args); |
71 | } | 71 | } |
72 | } | 72 | } |
@@ -321,8 +321,6 @@ soc_common_pcmcia_get_socket(struct pcmcia_socket *sock, socket_state_t *state) | |||
321 | * less punt all of this work and let the kernel handle the details | 321 | * less punt all of this work and let the kernel handle the details |
322 | * of power configuration, reset, &c. We also record the value of | 322 | * of power configuration, reset, &c. We also record the value of |
323 | * `state' in order to regurgitate it to the PCMCIA core later. | 323 | * `state' in order to regurgitate it to the PCMCIA core later. |
324 | * | ||
325 | * Returns: 0 | ||
326 | */ | 324 | */ |
327 | static int | 325 | static int |
328 | soc_common_pcmcia_set_socket(struct pcmcia_socket *sock, socket_state_t *state) | 326 | soc_common_pcmcia_set_socket(struct pcmcia_socket *sock, socket_state_t *state) |
@@ -407,7 +405,7 @@ soc_common_pcmcia_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *m | |||
407 | * the map speed as requested, but override the address ranges | 405 | * the map speed as requested, but override the address ranges |
408 | * supplied by Card Services. | 406 | * supplied by Card Services. |
409 | * | 407 | * |
410 | * Returns: 0 on success, -1 on error | 408 | * Returns: 0 on success, -ERRNO on error |
411 | */ | 409 | */ |
412 | static int | 410 | static int |
413 | soc_common_pcmcia_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *map) | 411 | soc_common_pcmcia_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *map) |
@@ -655,8 +653,8 @@ static void soc_pcmcia_cpufreq_unregister(void) | |||
655 | } | 653 | } |
656 | 654 | ||
657 | #else | 655 | #else |
658 | #define soc_pcmcia_cpufreq_register() | 656 | static int soc_pcmcia_cpufreq_register(void) { return 0; } |
659 | #define soc_pcmcia_cpufreq_unregister() | 657 | static void soc_pcmcia_cpufreq_unregister(void) {} |
660 | #endif | 658 | #endif |
661 | 659 | ||
662 | int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr) | 660 | int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr) |
@@ -738,7 +736,7 @@ int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops | |||
738 | goto out_err_5; | 736 | goto out_err_5; |
739 | } | 737 | } |
740 | 738 | ||
741 | if ( list_empty(&soc_pcmcia_sockets) ) | 739 | if (list_empty(&soc_pcmcia_sockets)) |
742 | soc_pcmcia_cpufreq_register(); | 740 | soc_pcmcia_cpufreq_register(); |
743 | 741 | ||
744 | list_add(&skt->node, &soc_pcmcia_sockets); | 742 | list_add(&skt->node, &soc_pcmcia_sockets); |
@@ -839,7 +837,7 @@ int soc_common_drv_pcmcia_remove(struct device *dev) | |||
839 | release_resource(&skt->res_io); | 837 | release_resource(&skt->res_io); |
840 | release_resource(&skt->res_skt); | 838 | release_resource(&skt->res_skt); |
841 | } | 839 | } |
842 | if ( list_empty(&soc_pcmcia_sockets) ) | 840 | if (list_empty(&soc_pcmcia_sockets)) |
843 | soc_pcmcia_cpufreq_unregister(); | 841 | soc_pcmcia_cpufreq_unregister(); |
844 | 842 | ||
845 | up(&soc_pcmcia_sockets_lock); | 843 | up(&soc_pcmcia_sockets_lock); |
diff --git a/drivers/pcmcia/ti113x.h b/drivers/pcmcia/ti113x.h index da0b404561c9..539b5cd1a598 100644 --- a/drivers/pcmcia/ti113x.h +++ b/drivers/pcmcia/ti113x.h | |||
@@ -873,6 +873,7 @@ static int ti1250_override(struct yenta_socket *socket) | |||
873 | * Some fixup code to make everybody happy (TM). | 873 | * Some fixup code to make everybody happy (TM). |
874 | */ | 874 | */ |
875 | 875 | ||
876 | #ifdef CONFIG_CARDBUS | ||
876 | /** | 877 | /** |
877 | * set/clear various test bits: | 878 | * set/clear various test bits: |
878 | * Defaults to clear the bit. | 879 | * Defaults to clear the bit. |
@@ -927,7 +928,6 @@ static void ene_tune_bridge(struct pcmcia_socket *sock, struct pci_bus *bus) | |||
927 | config_writeb(socket, ENE_TEST_C9, test_c9); | 928 | config_writeb(socket, ENE_TEST_C9, test_c9); |
928 | } | 929 | } |
929 | 930 | ||
930 | |||
931 | static int ene_override(struct yenta_socket *socket) | 931 | static int ene_override(struct yenta_socket *socket) |
932 | { | 932 | { |
933 | /* install tune_bridge() function */ | 933 | /* install tune_bridge() function */ |
@@ -935,6 +935,9 @@ static int ene_override(struct yenta_socket *socket) | |||
935 | 935 | ||
936 | return ti1250_override(socket); | 936 | return ti1250_override(socket); |
937 | } | 937 | } |
938 | #else | ||
939 | # define ene_override ti1250_override | ||
940 | #endif | ||
938 | 941 | ||
939 | #endif /* _LINUX_TI113X_H */ | 942 | #endif /* _LINUX_TI113X_H */ |
940 | 943 | ||
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 14c76f5e4177..9adc11e8b8bc 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -544,7 +544,7 @@ get_disc_ccwdev_by_devno(unsigned int devno, struct ccw_device *sibling) | |||
544 | .sibling = sibling, | 544 | .sibling = sibling, |
545 | }; | 545 | }; |
546 | 546 | ||
547 | dev = bus_find_device(&css_bus_type, NULL, &data, match_devno); | 547 | dev = bus_find_device(&ccw_bus_type, NULL, &data, match_devno); |
548 | 548 | ||
549 | return dev ? to_ccwdev(dev) : NULL; | 549 | return dev ? to_ccwdev(dev) : NULL; |
550 | } | 550 | } |
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index 0b5087f7cabc..cab098556b44 100644 --- a/drivers/s390/scsi/zfcp_aux.c +++ b/drivers/s390/scsi/zfcp_aux.c | |||
@@ -833,7 +833,7 @@ zfcp_unit_dequeue(struct zfcp_unit *unit) | |||
833 | } | 833 | } |
834 | 834 | ||
835 | static void * | 835 | static void * |
836 | zfcp_mempool_alloc(unsigned int __nocast gfp_mask, void *size) | 836 | zfcp_mempool_alloc(gfp_t gfp_mask, void *size) |
837 | { | 837 | { |
838 | return kmalloc((size_t) size, gfp_mask); | 838 | return kmalloc((size_t) size, gfp_mask); |
839 | } | 839 | } |
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 20019b82b4a8..9c9f162bd6ed 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -489,11 +489,11 @@ config SCSI_SATA_NV | |||
489 | 489 | ||
490 | If unsure, say N. | 490 | If unsure, say N. |
491 | 491 | ||
492 | config SCSI_SATA_PROMISE | 492 | config SCSI_PDC_ADMA |
493 | tristate "Promise SATA TX2/TX4 support" | 493 | tristate "Pacific Digital ADMA support" |
494 | depends on SCSI_SATA && PCI | 494 | depends on SCSI_SATA && PCI |
495 | help | 495 | help |
496 | This option enables support for Promise Serial ATA TX2/TX4. | 496 | This option enables support for Pacific Digital ADMA controllers |
497 | 497 | ||
498 | If unsure, say N. | 498 | If unsure, say N. |
499 | 499 | ||
@@ -505,6 +505,14 @@ config SCSI_SATA_QSTOR | |||
505 | 505 | ||
506 | If unsure, say N. | 506 | If unsure, say N. |
507 | 507 | ||
508 | config SCSI_SATA_PROMISE | ||
509 | tristate "Promise SATA TX2/TX4 support" | ||
510 | depends on SCSI_SATA && PCI | ||
511 | help | ||
512 | This option enables support for Promise Serial ATA TX2/TX4. | ||
513 | |||
514 | If unsure, say N. | ||
515 | |||
508 | config SCSI_SATA_SX4 | 516 | config SCSI_SATA_SX4 |
509 | tristate "Promise SATA SX4 support" | 517 | tristate "Promise SATA SX4 support" |
510 | depends on SCSI_SATA && PCI && EXPERIMENTAL | 518 | depends on SCSI_SATA && PCI && EXPERIMENTAL |
@@ -521,6 +529,14 @@ config SCSI_SATA_SIL | |||
521 | 529 | ||
522 | If unsure, say N. | 530 | If unsure, say N. |
523 | 531 | ||
532 | config SCSI_SATA_SIL24 | ||
533 | tristate "Silicon Image 3124/3132 SATA support" | ||
534 | depends on SCSI_SATA && PCI && EXPERIMENTAL | ||
535 | help | ||
536 | This option enables support for Silicon Image 3124/3132 Serial ATA. | ||
537 | |||
538 | If unsure, say N. | ||
539 | |||
524 | config SCSI_SATA_SIS | 540 | config SCSI_SATA_SIS |
525 | tristate "SiS 964/180 SATA support" | 541 | tristate "SiS 964/180 SATA support" |
526 | depends on SCSI_SATA && PCI && EXPERIMENTAL | 542 | depends on SCSI_SATA && PCI && EXPERIMENTAL |
@@ -553,6 +569,11 @@ config SCSI_SATA_VITESSE | |||
553 | 569 | ||
554 | If unsure, say N. | 570 | If unsure, say N. |
555 | 571 | ||
572 | config SCSI_SATA_INTEL_COMBINED | ||
573 | bool | ||
574 | depends on IDE=y && !BLK_DEV_IDE_SATA && (SCSI_SATA_AHCI || SCSI_ATA_PIIX) | ||
575 | default y | ||
576 | |||
556 | config SCSI_BUSLOGIC | 577 | config SCSI_BUSLOGIC |
557 | tristate "BusLogic SCSI support" | 578 | tristate "BusLogic SCSI support" |
558 | depends on (PCI || ISA || MCA) && SCSI && ISA_DMA_API | 579 | depends on (PCI || ISA || MCA) && SCSI && ISA_DMA_API |
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index 48529d180ca8..2d4439826c08 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile | |||
@@ -130,6 +130,7 @@ obj-$(CONFIG_SCSI_ATA_PIIX) += libata.o ata_piix.o | |||
130 | obj-$(CONFIG_SCSI_SATA_PROMISE) += libata.o sata_promise.o | 130 | obj-$(CONFIG_SCSI_SATA_PROMISE) += libata.o sata_promise.o |
131 | obj-$(CONFIG_SCSI_SATA_QSTOR) += libata.o sata_qstor.o | 131 | obj-$(CONFIG_SCSI_SATA_QSTOR) += libata.o sata_qstor.o |
132 | obj-$(CONFIG_SCSI_SATA_SIL) += libata.o sata_sil.o | 132 | obj-$(CONFIG_SCSI_SATA_SIL) += libata.o sata_sil.o |
133 | obj-$(CONFIG_SCSI_SATA_SIL24) += libata.o sata_sil24.o | ||
133 | obj-$(CONFIG_SCSI_SATA_VIA) += libata.o sata_via.o | 134 | obj-$(CONFIG_SCSI_SATA_VIA) += libata.o sata_via.o |
134 | obj-$(CONFIG_SCSI_SATA_VITESSE) += libata.o sata_vsc.o | 135 | obj-$(CONFIG_SCSI_SATA_VITESSE) += libata.o sata_vsc.o |
135 | obj-$(CONFIG_SCSI_SATA_SIS) += libata.o sata_sis.o | 136 | obj-$(CONFIG_SCSI_SATA_SIS) += libata.o sata_sis.o |
@@ -137,6 +138,7 @@ obj-$(CONFIG_SCSI_SATA_SX4) += libata.o sata_sx4.o | |||
137 | obj-$(CONFIG_SCSI_SATA_NV) += libata.o sata_nv.o | 138 | obj-$(CONFIG_SCSI_SATA_NV) += libata.o sata_nv.o |
138 | obj-$(CONFIG_SCSI_SATA_ULI) += libata.o sata_uli.o | 139 | obj-$(CONFIG_SCSI_SATA_ULI) += libata.o sata_uli.o |
139 | obj-$(CONFIG_SCSI_SATA_MV) += libata.o sata_mv.o | 140 | obj-$(CONFIG_SCSI_SATA_MV) += libata.o sata_mv.o |
141 | obj-$(CONFIG_SCSI_PDC_ADMA) += libata.o pdc_adma.o | ||
140 | 142 | ||
141 | obj-$(CONFIG_ARM) += arm/ | 143 | obj-$(CONFIG_ARM) += arm/ |
142 | 144 | ||
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index de8490a92831..a1f9ceef0ac9 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -453,9 +453,9 @@ static int aac_eh_reset(struct scsi_cmnd* cmd) | |||
453 | /* | 453 | /* |
454 | * We can exit If all the commands are complete | 454 | * We can exit If all the commands are complete |
455 | */ | 455 | */ |
456 | spin_unlock_irq(host->host_lock); | ||
456 | if (active == 0) | 457 | if (active == 0) |
457 | return SUCCESS; | 458 | return SUCCESS; |
458 | spin_unlock_irq(host->host_lock); | ||
459 | ssleep(1); | 459 | ssleep(1); |
460 | spin_lock_irq(host->host_lock); | 460 | spin_lock_irq(host->host_lock); |
461 | } | 461 | } |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 9eb24d3f18db..b16955b0c4d1 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -63,6 +63,7 @@ | |||
63 | static unsigned int ata_busy_sleep (struct ata_port *ap, | 63 | static unsigned int ata_busy_sleep (struct ata_port *ap, |
64 | unsigned long tmout_pat, | 64 | unsigned long tmout_pat, |
65 | unsigned long tmout); | 65 | unsigned long tmout); |
66 | static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev); | ||
66 | static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev); | 67 | static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev); |
67 | static void ata_set_mode(struct ata_port *ap); | 68 | static void ata_set_mode(struct ata_port *ap); |
68 | static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev); | 69 | static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev); |
@@ -617,79 +618,53 @@ void ata_tf_from_fis(u8 *fis, struct ata_taskfile *tf) | |||
617 | tf->hob_nsect = fis[13]; | 618 | tf->hob_nsect = fis[13]; |
618 | } | 619 | } |
619 | 620 | ||
620 | /** | 621 | static const u8 ata_rw_cmds[] = { |
621 | * ata_prot_to_cmd - determine which read/write opcodes to use | 622 | /* pio multi */ |
622 | * @protocol: ATA_PROT_xxx taskfile protocol | 623 | ATA_CMD_READ_MULTI, |
623 | * @lba48: true is lba48 is present | 624 | ATA_CMD_WRITE_MULTI, |
624 | * | 625 | ATA_CMD_READ_MULTI_EXT, |
625 | * Given necessary input, determine which read/write commands | 626 | ATA_CMD_WRITE_MULTI_EXT, |
626 | * to use to transfer data. | 627 | /* pio */ |
627 | * | 628 | ATA_CMD_PIO_READ, |
628 | * LOCKING: | 629 | ATA_CMD_PIO_WRITE, |
629 | * None. | 630 | ATA_CMD_PIO_READ_EXT, |
630 | */ | 631 | ATA_CMD_PIO_WRITE_EXT, |
631 | static int ata_prot_to_cmd(int protocol, int lba48) | 632 | /* dma */ |
632 | { | 633 | ATA_CMD_READ, |
633 | int rcmd = 0, wcmd = 0; | 634 | ATA_CMD_WRITE, |
634 | 635 | ATA_CMD_READ_EXT, | |
635 | switch (protocol) { | 636 | ATA_CMD_WRITE_EXT |
636 | case ATA_PROT_PIO: | 637 | }; |
637 | if (lba48) { | ||
638 | rcmd = ATA_CMD_PIO_READ_EXT; | ||
639 | wcmd = ATA_CMD_PIO_WRITE_EXT; | ||
640 | } else { | ||
641 | rcmd = ATA_CMD_PIO_READ; | ||
642 | wcmd = ATA_CMD_PIO_WRITE; | ||
643 | } | ||
644 | break; | ||
645 | |||
646 | case ATA_PROT_DMA: | ||
647 | if (lba48) { | ||
648 | rcmd = ATA_CMD_READ_EXT; | ||
649 | wcmd = ATA_CMD_WRITE_EXT; | ||
650 | } else { | ||
651 | rcmd = ATA_CMD_READ; | ||
652 | wcmd = ATA_CMD_WRITE; | ||
653 | } | ||
654 | break; | ||
655 | |||
656 | default: | ||
657 | return -1; | ||
658 | } | ||
659 | |||
660 | return rcmd | (wcmd << 8); | ||
661 | } | ||
662 | 638 | ||
663 | /** | 639 | /** |
664 | * ata_dev_set_protocol - set taskfile protocol and r/w commands | 640 | * ata_rwcmd_protocol - set taskfile r/w commands and protocol |
665 | * @dev: device to examine and configure | 641 | * @qc: command to examine and configure |
666 | * | 642 | * |
667 | * Examine the device configuration, after we have | 643 | * Examine the device configuration and tf->flags to calculate |
668 | * read the identify-device page and configured the | 644 | * the proper read/write commands and protocol to use. |
669 | * data transfer mode. Set internal state related to | ||
670 | * the ATA taskfile protocol (pio, pio mult, dma, etc.) | ||
671 | * and calculate the proper read/write commands to use. | ||
672 | * | 645 | * |
673 | * LOCKING: | 646 | * LOCKING: |
674 | * caller. | 647 | * caller. |
675 | */ | 648 | */ |
676 | static void ata_dev_set_protocol(struct ata_device *dev) | 649 | void ata_rwcmd_protocol(struct ata_queued_cmd *qc) |
677 | { | 650 | { |
678 | int pio = (dev->flags & ATA_DFLAG_PIO); | 651 | struct ata_taskfile *tf = &qc->tf; |
679 | int lba48 = (dev->flags & ATA_DFLAG_LBA48); | 652 | struct ata_device *dev = qc->dev; |
680 | int proto, cmd; | ||
681 | 653 | ||
682 | if (pio) | 654 | int index, lba48, write; |
683 | proto = dev->xfer_protocol = ATA_PROT_PIO; | 655 | |
684 | else | 656 | lba48 = (tf->flags & ATA_TFLAG_LBA48) ? 2 : 0; |
685 | proto = dev->xfer_protocol = ATA_PROT_DMA; | 657 | write = (tf->flags & ATA_TFLAG_WRITE) ? 1 : 0; |
686 | 658 | ||
687 | cmd = ata_prot_to_cmd(proto, lba48); | 659 | if (dev->flags & ATA_DFLAG_PIO) { |
688 | if (cmd < 0) | 660 | tf->protocol = ATA_PROT_PIO; |
689 | BUG(); | 661 | index = dev->multi_count ? 0 : 4; |
662 | } else { | ||
663 | tf->protocol = ATA_PROT_DMA; | ||
664 | index = 8; | ||
665 | } | ||
690 | 666 | ||
691 | dev->read_cmd = cmd & 0xff; | 667 | tf->command = ata_rw_cmds[index + lba48 + write]; |
692 | dev->write_cmd = (cmd >> 8) & 0xff; | ||
693 | } | 668 | } |
694 | 669 | ||
695 | static const char * xfer_mode_str[] = { | 670 | static const char * xfer_mode_str[] = { |
@@ -1267,9 +1242,15 @@ retry: | |||
1267 | * anything else.. | 1242 | * anything else.. |
1268 | * Some drives were very specific about that exact sequence. | 1243 | * Some drives were very specific about that exact sequence. |
1269 | */ | 1244 | */ |
1270 | if (major_version < 4 || (!ata_id_has_lba(dev->id))) | 1245 | if (major_version < 4 || (!ata_id_has_lba(dev->id))) { |
1271 | ata_dev_init_params(ap, dev); | 1246 | ata_dev_init_params(ap, dev); |
1272 | 1247 | ||
1248 | /* current CHS translation info (id[53-58]) might be | ||
1249 | * changed. reread the identify device info. | ||
1250 | */ | ||
1251 | ata_dev_reread_id(ap, dev); | ||
1252 | } | ||
1253 | |||
1273 | if (ata_id_has_lba(dev->id)) { | 1254 | if (ata_id_has_lba(dev->id)) { |
1274 | dev->flags |= ATA_DFLAG_LBA; | 1255 | dev->flags |= ATA_DFLAG_LBA; |
1275 | 1256 | ||
@@ -1645,7 +1626,7 @@ static void ata_host_set_dma(struct ata_port *ap, u8 xfer_mode, | |||
1645 | */ | 1626 | */ |
1646 | static void ata_set_mode(struct ata_port *ap) | 1627 | static void ata_set_mode(struct ata_port *ap) |
1647 | { | 1628 | { |
1648 | unsigned int i, xfer_shift; | 1629 | unsigned int xfer_shift; |
1649 | u8 xfer_mode; | 1630 | u8 xfer_mode; |
1650 | int rc; | 1631 | int rc; |
1651 | 1632 | ||
@@ -1674,11 +1655,6 @@ static void ata_set_mode(struct ata_port *ap) | |||
1674 | if (ap->ops->post_set_mode) | 1655 | if (ap->ops->post_set_mode) |
1675 | ap->ops->post_set_mode(ap); | 1656 | ap->ops->post_set_mode(ap); |
1676 | 1657 | ||
1677 | for (i = 0; i < 2; i++) { | ||
1678 | struct ata_device *dev = &ap->device[i]; | ||
1679 | ata_dev_set_protocol(dev); | ||
1680 | } | ||
1681 | |||
1682 | return; | 1658 | return; |
1683 | 1659 | ||
1684 | err_out: | 1660 | err_out: |
@@ -2186,6 +2162,62 @@ static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev) | |||
2186 | } | 2162 | } |
2187 | 2163 | ||
2188 | /** | 2164 | /** |
2165 | * ata_dev_reread_id - Reread the device identify device info | ||
2166 | * @ap: port where the device is | ||
2167 | * @dev: device to reread the identify device info | ||
2168 | * | ||
2169 | * LOCKING: | ||
2170 | */ | ||
2171 | |||
2172 | static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev) | ||
2173 | { | ||
2174 | DECLARE_COMPLETION(wait); | ||
2175 | struct ata_queued_cmd *qc; | ||
2176 | unsigned long flags; | ||
2177 | int rc; | ||
2178 | |||
2179 | qc = ata_qc_new_init(ap, dev); | ||
2180 | BUG_ON(qc == NULL); | ||
2181 | |||
2182 | ata_sg_init_one(qc, dev->id, sizeof(dev->id)); | ||
2183 | qc->dma_dir = DMA_FROM_DEVICE; | ||
2184 | |||
2185 | if (dev->class == ATA_DEV_ATA) { | ||
2186 | qc->tf.command = ATA_CMD_ID_ATA; | ||
2187 | DPRINTK("do ATA identify\n"); | ||
2188 | } else { | ||
2189 | qc->tf.command = ATA_CMD_ID_ATAPI; | ||
2190 | DPRINTK("do ATAPI identify\n"); | ||
2191 | } | ||
2192 | |||
2193 | qc->tf.flags |= ATA_TFLAG_DEVICE; | ||
2194 | qc->tf.protocol = ATA_PROT_PIO; | ||
2195 | qc->nsect = 1; | ||
2196 | |||
2197 | qc->waiting = &wait; | ||
2198 | qc->complete_fn = ata_qc_complete_noop; | ||
2199 | |||
2200 | spin_lock_irqsave(&ap->host_set->lock, flags); | ||
2201 | rc = ata_qc_issue(qc); | ||
2202 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | ||
2203 | |||
2204 | if (rc) | ||
2205 | goto err_out; | ||
2206 | |||
2207 | wait_for_completion(&wait); | ||
2208 | |||
2209 | swap_buf_le16(dev->id, ATA_ID_WORDS); | ||
2210 | |||
2211 | ata_dump_id(dev); | ||
2212 | |||
2213 | DPRINTK("EXIT\n"); | ||
2214 | |||
2215 | return; | ||
2216 | err_out: | ||
2217 | ata_port_disable(ap); | ||
2218 | } | ||
2219 | |||
2220 | /** | ||
2189 | * ata_dev_init_params - Issue INIT DEV PARAMS command | 2221 | * ata_dev_init_params - Issue INIT DEV PARAMS command |
2190 | * @ap: Port associated with device @dev | 2222 | * @ap: Port associated with device @dev |
2191 | * @dev: Device to which command will be sent | 2223 | * @dev: Device to which command will be sent |
@@ -3327,13 +3359,6 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, | |||
3327 | qc->nbytes = qc->curbytes = 0; | 3359 | qc->nbytes = qc->curbytes = 0; |
3328 | 3360 | ||
3329 | ata_tf_init(ap, &qc->tf, dev->devno); | 3361 | ata_tf_init(ap, &qc->tf, dev->devno); |
3330 | |||
3331 | if (dev->flags & ATA_DFLAG_LBA) { | ||
3332 | qc->tf.flags |= ATA_TFLAG_LBA; | ||
3333 | |||
3334 | if (dev->flags & ATA_DFLAG_LBA48) | ||
3335 | qc->tf.flags |= ATA_TFLAG_LBA48; | ||
3336 | } | ||
3337 | } | 3362 | } |
3338 | 3363 | ||
3339 | return qc; | 3364 | return qc; |
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index c64169ca7ff0..90bf22204668 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -492,7 +492,7 @@ static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) | |||
492 | tf->flags |= ATA_TFLAG_DEVICE; | 492 | tf->flags |= ATA_TFLAG_DEVICE; |
493 | tf->protocol = ATA_PROT_NODATA; | 493 | tf->protocol = ATA_PROT_NODATA; |
494 | 494 | ||
495 | if ((tf->flags & ATA_TFLAG_LBA48) && | 495 | if ((qc->dev->flags & ATA_DFLAG_LBA48) && |
496 | (ata_id_has_flush_ext(qc->dev->id))) | 496 | (ata_id_has_flush_ext(qc->dev->id))) |
497 | tf->command = ATA_CMD_FLUSH_EXT; | 497 | tf->command = ATA_CMD_FLUSH_EXT; |
498 | else | 498 | else |
@@ -612,8 +612,6 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) | |||
612 | { | 612 | { |
613 | struct ata_taskfile *tf = &qc->tf; | 613 | struct ata_taskfile *tf = &qc->tf; |
614 | struct ata_device *dev = qc->dev; | 614 | struct ata_device *dev = qc->dev; |
615 | unsigned int lba = tf->flags & ATA_TFLAG_LBA; | ||
616 | unsigned int lba48 = tf->flags & ATA_TFLAG_LBA48; | ||
617 | u64 dev_sectors = qc->dev->n_sectors; | 615 | u64 dev_sectors = qc->dev->n_sectors; |
618 | u64 block; | 616 | u64 block; |
619 | u32 n_block; | 617 | u32 n_block; |
@@ -634,16 +632,16 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) | |||
634 | goto out_of_range; | 632 | goto out_of_range; |
635 | if ((block + n_block) > dev_sectors) | 633 | if ((block + n_block) > dev_sectors) |
636 | goto out_of_range; | 634 | goto out_of_range; |
637 | if (lba48) { | ||
638 | if (n_block > (64 * 1024)) | ||
639 | goto invalid_fld; | ||
640 | } else { | ||
641 | if (n_block > 256) | ||
642 | goto invalid_fld; | ||
643 | } | ||
644 | 635 | ||
645 | if (lba) { | 636 | if (dev->flags & ATA_DFLAG_LBA) { |
646 | if (lba48) { | 637 | tf->flags |= ATA_TFLAG_LBA; |
638 | |||
639 | if (dev->flags & ATA_DFLAG_LBA48) { | ||
640 | if (n_block > (64 * 1024)) | ||
641 | goto invalid_fld; | ||
642 | |||
643 | /* use LBA48 */ | ||
644 | tf->flags |= ATA_TFLAG_LBA48; | ||
647 | tf->command = ATA_CMD_VERIFY_EXT; | 645 | tf->command = ATA_CMD_VERIFY_EXT; |
648 | 646 | ||
649 | tf->hob_nsect = (n_block >> 8) & 0xff; | 647 | tf->hob_nsect = (n_block >> 8) & 0xff; |
@@ -652,6 +650,10 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) | |||
652 | tf->hob_lbam = (block >> 32) & 0xff; | 650 | tf->hob_lbam = (block >> 32) & 0xff; |
653 | tf->hob_lbal = (block >> 24) & 0xff; | 651 | tf->hob_lbal = (block >> 24) & 0xff; |
654 | } else { | 652 | } else { |
653 | if (n_block > 256) | ||
654 | goto invalid_fld; | ||
655 | |||
656 | /* use LBA28 */ | ||
655 | tf->command = ATA_CMD_VERIFY; | 657 | tf->command = ATA_CMD_VERIFY; |
656 | 658 | ||
657 | tf->device |= (block >> 24) & 0xf; | 659 | tf->device |= (block >> 24) & 0xf; |
@@ -668,6 +670,9 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) | |||
668 | /* CHS */ | 670 | /* CHS */ |
669 | u32 sect, head, cyl, track; | 671 | u32 sect, head, cyl, track; |
670 | 672 | ||
673 | if (n_block > 256) | ||
674 | goto invalid_fld; | ||
675 | |||
671 | /* Convert LBA to CHS */ | 676 | /* Convert LBA to CHS */ |
672 | track = (u32)block / dev->sectors; | 677 | track = (u32)block / dev->sectors; |
673 | cyl = track / dev->heads; | 678 | cyl = track / dev->heads; |
@@ -733,21 +738,14 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) | |||
733 | { | 738 | { |
734 | struct ata_taskfile *tf = &qc->tf; | 739 | struct ata_taskfile *tf = &qc->tf; |
735 | struct ata_device *dev = qc->dev; | 740 | struct ata_device *dev = qc->dev; |
736 | unsigned int lba = tf->flags & ATA_TFLAG_LBA; | ||
737 | unsigned int lba48 = tf->flags & ATA_TFLAG_LBA48; | ||
738 | u64 block; | 741 | u64 block; |
739 | u32 n_block; | 742 | u32 n_block; |
740 | 743 | ||
741 | tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; | 744 | tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; |
742 | tf->protocol = qc->dev->xfer_protocol; | ||
743 | 745 | ||
744 | if (scsicmd[0] == READ_10 || scsicmd[0] == READ_6 || | 746 | if (scsicmd[0] == WRITE_10 || scsicmd[0] == WRITE_6 || |
745 | scsicmd[0] == READ_16) { | 747 | scsicmd[0] == WRITE_16) |
746 | tf->command = qc->dev->read_cmd; | ||
747 | } else { | ||
748 | tf->command = qc->dev->write_cmd; | ||
749 | tf->flags |= ATA_TFLAG_WRITE; | 748 | tf->flags |= ATA_TFLAG_WRITE; |
750 | } | ||
751 | 749 | ||
752 | /* Calculate the SCSI LBA and transfer length. */ | 750 | /* Calculate the SCSI LBA and transfer length. */ |
753 | switch (scsicmd[0]) { | 751 | switch (scsicmd[0]) { |
@@ -783,19 +781,24 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) | |||
783 | */ | 781 | */ |
784 | goto nothing_to_do; | 782 | goto nothing_to_do; |
785 | 783 | ||
786 | if (lba) { | 784 | if (dev->flags & ATA_DFLAG_LBA) { |
787 | if (lba48) { | 785 | tf->flags |= ATA_TFLAG_LBA; |
786 | |||
787 | if (dev->flags & ATA_DFLAG_LBA48) { | ||
788 | /* The request -may- be too large for LBA48. */ | 788 | /* The request -may- be too large for LBA48. */ |
789 | if ((block >> 48) || (n_block > 65536)) | 789 | if ((block >> 48) || (n_block > 65536)) |
790 | goto out_of_range; | 790 | goto out_of_range; |
791 | 791 | ||
792 | /* use LBA48 */ | ||
793 | tf->flags |= ATA_TFLAG_LBA48; | ||
794 | |||
792 | tf->hob_nsect = (n_block >> 8) & 0xff; | 795 | tf->hob_nsect = (n_block >> 8) & 0xff; |
793 | 796 | ||
794 | tf->hob_lbah = (block >> 40) & 0xff; | 797 | tf->hob_lbah = (block >> 40) & 0xff; |
795 | tf->hob_lbam = (block >> 32) & 0xff; | 798 | tf->hob_lbam = (block >> 32) & 0xff; |
796 | tf->hob_lbal = (block >> 24) & 0xff; | 799 | tf->hob_lbal = (block >> 24) & 0xff; |
797 | } else { | 800 | } else { |
798 | /* LBA28 */ | 801 | /* use LBA28 */ |
799 | 802 | ||
800 | /* The request -may- be too large for LBA28. */ | 803 | /* The request -may- be too large for LBA28. */ |
801 | if ((block >> 28) || (n_block > 256)) | 804 | if ((block >> 28) || (n_block > 256)) |
@@ -804,6 +807,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) | |||
804 | tf->device |= (block >> 24) & 0xf; | 807 | tf->device |= (block >> 24) & 0xf; |
805 | } | 808 | } |
806 | 809 | ||
810 | ata_rwcmd_protocol(qc); | ||
811 | |||
807 | qc->nsect = n_block; | 812 | qc->nsect = n_block; |
808 | tf->nsect = n_block & 0xff; | 813 | tf->nsect = n_block & 0xff; |
809 | 814 | ||
@@ -820,6 +825,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) | |||
820 | if ((block >> 28) || (n_block > 256)) | 825 | if ((block >> 28) || (n_block > 256)) |
821 | goto out_of_range; | 826 | goto out_of_range; |
822 | 827 | ||
828 | ata_rwcmd_protocol(qc); | ||
829 | |||
823 | /* Convert LBA to CHS */ | 830 | /* Convert LBA to CHS */ |
824 | track = (u32)block / dev->sectors; | 831 | track = (u32)block / dev->sectors; |
825 | cyl = track / dev->heads; | 832 | cyl = track / dev->heads; |
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h index a18f2ac1d4a1..67d752ca8ae2 100644 --- a/drivers/scsi/libata.h +++ b/drivers/scsi/libata.h | |||
@@ -42,6 +42,7 @@ extern int atapi_enabled; | |||
42 | extern int ata_qc_complete_noop(struct ata_queued_cmd *qc, u8 drv_stat); | 42 | extern int ata_qc_complete_noop(struct ata_queued_cmd *qc, u8 drv_stat); |
43 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, | 43 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, |
44 | struct ata_device *dev); | 44 | struct ata_device *dev); |
45 | extern void ata_rwcmd_protocol(struct ata_queued_cmd *qc); | ||
45 | extern void ata_qc_free(struct ata_queued_cmd *qc); | 46 | extern void ata_qc_free(struct ata_queued_cmd *qc); |
46 | extern int ata_qc_issue(struct ata_queued_cmd *qc); | 47 | extern int ata_qc_issue(struct ata_queued_cmd *qc); |
47 | extern int ata_check_atapi_dma(struct ata_queued_cmd *qc); | 48 | extern int ata_check_atapi_dma(struct ata_queued_cmd *qc); |
diff --git a/drivers/scsi/pdc_adma.c b/drivers/scsi/pdc_adma.c new file mode 100644 index 000000000000..53b8db4be1a9 --- /dev/null +++ b/drivers/scsi/pdc_adma.c | |||
@@ -0,0 +1,739 @@ | |||
1 | /* | ||
2 | * pdc_adma.c - Pacific Digital Corporation ADMA | ||
3 | * | ||
4 | * Maintained by: Mark Lord <mlord@pobox.com> | ||
5 | * | ||
6 | * Copyright 2005 Mark Lord | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2, or (at your option) | ||
11 | * any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; see the file COPYING. If not, write to | ||
20 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | ||
21 | * | ||
22 | * | ||
23 | * libata documentation is available via 'make {ps|pdf}docs', | ||
24 | * as Documentation/DocBook/libata.* | ||
25 | * | ||
26 | * | ||
27 | * Supports ATA disks in single-packet ADMA mode. | ||
28 | * Uses PIO for everything else. | ||
29 | * | ||
30 | * TODO: Use ADMA transfers for ATAPI devices, when possible. | ||
31 | * This requires careful attention to a number of quirks of the chip. | ||
32 | * | ||
33 | */ | ||
34 | |||
35 | #include <linux/kernel.h> | ||
36 | #include <linux/module.h> | ||
37 | #include <linux/pci.h> | ||
38 | #include <linux/init.h> | ||
39 | #include <linux/blkdev.h> | ||
40 | #include <linux/delay.h> | ||
41 | #include <linux/interrupt.h> | ||
42 | #include <linux/sched.h> | ||
43 | #include "scsi.h" | ||
44 | #include <scsi/scsi_host.h> | ||
45 | #include <asm/io.h> | ||
46 | #include <linux/libata.h> | ||
47 | |||
48 | #define DRV_NAME "pdc_adma" | ||
49 | #define DRV_VERSION "0.01" | ||
50 | |||
51 | /* macro to calculate base address for ATA regs */ | ||
52 | #define ADMA_ATA_REGS(base,port_no) ((base) + ((port_no) * 0x40)) | ||
53 | |||
54 | /* macro to calculate base address for ADMA regs */ | ||
55 | #define ADMA_REGS(base,port_no) ((base) + 0x80 + ((port_no) * 0x20)) | ||
56 | |||
57 | enum { | ||
58 | ADMA_PORTS = 2, | ||
59 | ADMA_CPB_BYTES = 40, | ||
60 | ADMA_PRD_BYTES = LIBATA_MAX_PRD * 16, | ||
61 | ADMA_PKT_BYTES = ADMA_CPB_BYTES + ADMA_PRD_BYTES, | ||
62 | |||
63 | ADMA_DMA_BOUNDARY = 0xffffffff, | ||
64 | |||
65 | /* global register offsets */ | ||
66 | ADMA_MODE_LOCK = 0x00c7, | ||
67 | |||
68 | /* per-channel register offsets */ | ||
69 | ADMA_CONTROL = 0x0000, /* ADMA control */ | ||
70 | ADMA_STATUS = 0x0002, /* ADMA status */ | ||
71 | ADMA_CPB_COUNT = 0x0004, /* CPB count */ | ||
72 | ADMA_CPB_CURRENT = 0x000c, /* current CPB address */ | ||
73 | ADMA_CPB_NEXT = 0x000c, /* next CPB address */ | ||
74 | ADMA_CPB_LOOKUP = 0x0010, /* CPB lookup table */ | ||
75 | ADMA_FIFO_IN = 0x0014, /* input FIFO threshold */ | ||
76 | ADMA_FIFO_OUT = 0x0016, /* output FIFO threshold */ | ||
77 | |||
78 | /* ADMA_CONTROL register bits */ | ||
79 | aNIEN = (1 << 8), /* irq mask: 1==masked */ | ||
80 | aGO = (1 << 7), /* packet trigger ("Go!") */ | ||
81 | aRSTADM = (1 << 5), /* ADMA logic reset */ | ||
82 | aRSTA = (1 << 2), /* ATA hard reset */ | ||
83 | aPIOMD4 = 0x0003, /* PIO mode 4 */ | ||
84 | |||
85 | /* ADMA_STATUS register bits */ | ||
86 | aPSD = (1 << 6), | ||
87 | aUIRQ = (1 << 4), | ||
88 | aPERR = (1 << 0), | ||
89 | |||
90 | /* CPB bits */ | ||
91 | cDONE = (1 << 0), | ||
92 | cVLD = (1 << 0), | ||
93 | cDAT = (1 << 2), | ||
94 | cIEN = (1 << 3), | ||
95 | |||
96 | /* PRD bits */ | ||
97 | pORD = (1 << 4), | ||
98 | pDIRO = (1 << 5), | ||
99 | pEND = (1 << 7), | ||
100 | |||
101 | /* ATA register flags */ | ||
102 | rIGN = (1 << 5), | ||
103 | rEND = (1 << 7), | ||
104 | |||
105 | /* ATA register addresses */ | ||
106 | ADMA_REGS_CONTROL = 0x0e, | ||
107 | ADMA_REGS_SECTOR_COUNT = 0x12, | ||
108 | ADMA_REGS_LBA_LOW = 0x13, | ||
109 | ADMA_REGS_LBA_MID = 0x14, | ||
110 | ADMA_REGS_LBA_HIGH = 0x15, | ||
111 | ADMA_REGS_DEVICE = 0x16, | ||
112 | ADMA_REGS_COMMAND = 0x17, | ||
113 | |||
114 | /* PCI device IDs */ | ||
115 | board_1841_idx = 0, /* ADMA 2-port controller */ | ||
116 | }; | ||
117 | |||
118 | typedef enum { adma_state_idle, adma_state_pkt, adma_state_mmio } adma_state_t; | ||
119 | |||
120 | struct adma_port_priv { | ||
121 | u8 *pkt; | ||
122 | dma_addr_t pkt_dma; | ||
123 | adma_state_t state; | ||
124 | }; | ||
125 | |||
126 | static int adma_ata_init_one (struct pci_dev *pdev, | ||
127 | const struct pci_device_id *ent); | ||
128 | static irqreturn_t adma_intr (int irq, void *dev_instance, | ||
129 | struct pt_regs *regs); | ||
130 | static int adma_port_start(struct ata_port *ap); | ||
131 | static void adma_host_stop(struct ata_host_set *host_set); | ||
132 | static void adma_port_stop(struct ata_port *ap); | ||
133 | static void adma_phy_reset(struct ata_port *ap); | ||
134 | static void adma_qc_prep(struct ata_queued_cmd *qc); | ||
135 | static int adma_qc_issue(struct ata_queued_cmd *qc); | ||
136 | static int adma_check_atapi_dma(struct ata_queued_cmd *qc); | ||
137 | static void adma_bmdma_stop(struct ata_queued_cmd *qc); | ||
138 | static u8 adma_bmdma_status(struct ata_port *ap); | ||
139 | static void adma_irq_clear(struct ata_port *ap); | ||
140 | static void adma_eng_timeout(struct ata_port *ap); | ||
141 | |||
142 | static Scsi_Host_Template adma_ata_sht = { | ||
143 | .module = THIS_MODULE, | ||
144 | .name = DRV_NAME, | ||
145 | .ioctl = ata_scsi_ioctl, | ||
146 | .queuecommand = ata_scsi_queuecmd, | ||
147 | .eh_strategy_handler = ata_scsi_error, | ||
148 | .can_queue = ATA_DEF_QUEUE, | ||
149 | .this_id = ATA_SHT_THIS_ID, | ||
150 | .sg_tablesize = LIBATA_MAX_PRD, | ||
151 | .max_sectors = ATA_MAX_SECTORS, | ||
152 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, | ||
153 | .emulated = ATA_SHT_EMULATED, | ||
154 | .use_clustering = ENABLE_CLUSTERING, | ||
155 | .proc_name = DRV_NAME, | ||
156 | .dma_boundary = ADMA_DMA_BOUNDARY, | ||
157 | .slave_configure = ata_scsi_slave_config, | ||
158 | .bios_param = ata_std_bios_param, | ||
159 | }; | ||
160 | |||
161 | static struct ata_port_operations adma_ata_ops = { | ||
162 | .port_disable = ata_port_disable, | ||
163 | .tf_load = ata_tf_load, | ||
164 | .tf_read = ata_tf_read, | ||
165 | .check_status = ata_check_status, | ||
166 | .check_atapi_dma = adma_check_atapi_dma, | ||
167 | .exec_command = ata_exec_command, | ||
168 | .dev_select = ata_std_dev_select, | ||
169 | .phy_reset = adma_phy_reset, | ||
170 | .qc_prep = adma_qc_prep, | ||
171 | .qc_issue = adma_qc_issue, | ||
172 | .eng_timeout = adma_eng_timeout, | ||
173 | .irq_handler = adma_intr, | ||
174 | .irq_clear = adma_irq_clear, | ||
175 | .port_start = adma_port_start, | ||
176 | .port_stop = adma_port_stop, | ||
177 | .host_stop = adma_host_stop, | ||
178 | .bmdma_stop = adma_bmdma_stop, | ||
179 | .bmdma_status = adma_bmdma_status, | ||
180 | }; | ||
181 | |||
182 | static struct ata_port_info adma_port_info[] = { | ||
183 | /* board_1841_idx */ | ||
184 | { | ||
185 | .sht = &adma_ata_sht, | ||
186 | .host_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | | ||
187 | ATA_FLAG_NO_LEGACY | ATA_FLAG_MMIO, | ||
188 | .pio_mask = 0x10, /* pio4 */ | ||
189 | .udma_mask = 0x1f, /* udma0-4 */ | ||
190 | .port_ops = &adma_ata_ops, | ||
191 | }, | ||
192 | }; | ||
193 | |||
194 | static struct pci_device_id adma_ata_pci_tbl[] = { | ||
195 | { PCI_VENDOR_ID_PDC, 0x1841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
196 | board_1841_idx }, | ||
197 | |||
198 | { } /* terminate list */ | ||
199 | }; | ||
200 | |||
201 | static struct pci_driver adma_ata_pci_driver = { | ||
202 | .name = DRV_NAME, | ||
203 | .id_table = adma_ata_pci_tbl, | ||
204 | .probe = adma_ata_init_one, | ||
205 | .remove = ata_pci_remove_one, | ||
206 | }; | ||
207 | |||
208 | static int adma_check_atapi_dma(struct ata_queued_cmd *qc) | ||
209 | { | ||
210 | return 1; /* ATAPI DMA not yet supported */ | ||
211 | } | ||
212 | |||
213 | static void adma_bmdma_stop(struct ata_queued_cmd *qc) | ||
214 | { | ||
215 | /* nothing */ | ||
216 | } | ||
217 | |||
218 | static u8 adma_bmdma_status(struct ata_port *ap) | ||
219 | { | ||
220 | return 0; | ||
221 | } | ||
222 | |||
223 | static void adma_irq_clear(struct ata_port *ap) | ||
224 | { | ||
225 | /* nothing */ | ||
226 | } | ||
227 | |||
228 | static void adma_reset_engine(void __iomem *chan) | ||
229 | { | ||
230 | /* reset ADMA to idle state */ | ||
231 | writew(aPIOMD4 | aNIEN | aRSTADM, chan + ADMA_CONTROL); | ||
232 | udelay(2); | ||
233 | writew(aPIOMD4, chan + ADMA_CONTROL); | ||
234 | udelay(2); | ||
235 | } | ||
236 | |||
237 | static void adma_reinit_engine(struct ata_port *ap) | ||
238 | { | ||
239 | struct adma_port_priv *pp = ap->private_data; | ||
240 | void __iomem *mmio_base = ap->host_set->mmio_base; | ||
241 | void __iomem *chan = ADMA_REGS(mmio_base, ap->port_no); | ||
242 | |||
243 | /* mask/clear ATA interrupts */ | ||
244 | writeb(ATA_NIEN, (void __iomem *)ap->ioaddr.ctl_addr); | ||
245 | ata_check_status(ap); | ||
246 | |||
247 | /* reset the ADMA engine */ | ||
248 | adma_reset_engine(chan); | ||
249 | |||
250 | /* set in-FIFO threshold to 0x100 */ | ||
251 | writew(0x100, chan + ADMA_FIFO_IN); | ||
252 | |||
253 | /* set CPB pointer */ | ||
254 | writel((u32)pp->pkt_dma, chan + ADMA_CPB_NEXT); | ||
255 | |||
256 | /* set out-FIFO threshold to 0x100 */ | ||
257 | writew(0x100, chan + ADMA_FIFO_OUT); | ||
258 | |||
259 | /* set CPB count */ | ||
260 | writew(1, chan + ADMA_CPB_COUNT); | ||
261 | |||
262 | /* read/discard ADMA status */ | ||
263 | readb(chan + ADMA_STATUS); | ||
264 | } | ||
265 | |||
266 | static inline void adma_enter_reg_mode(struct ata_port *ap) | ||
267 | { | ||
268 | void __iomem *chan = ADMA_REGS(ap->host_set->mmio_base, ap->port_no); | ||
269 | |||
270 | writew(aPIOMD4, chan + ADMA_CONTROL); | ||
271 | readb(chan + ADMA_STATUS); /* flush */ | ||
272 | } | ||
273 | |||
274 | static void adma_phy_reset(struct ata_port *ap) | ||
275 | { | ||
276 | struct adma_port_priv *pp = ap->private_data; | ||
277 | |||
278 | pp->state = adma_state_idle; | ||
279 | adma_reinit_engine(ap); | ||
280 | ata_port_probe(ap); | ||
281 | ata_bus_reset(ap); | ||
282 | } | ||
283 | |||
284 | static void adma_eng_timeout(struct ata_port *ap) | ||
285 | { | ||
286 | struct adma_port_priv *pp = ap->private_data; | ||
287 | |||
288 | if (pp->state != adma_state_idle) /* healthy paranoia */ | ||
289 | pp->state = adma_state_mmio; | ||
290 | adma_reinit_engine(ap); | ||
291 | ata_eng_timeout(ap); | ||
292 | } | ||
293 | |||
294 | static int adma_fill_sg(struct ata_queued_cmd *qc) | ||
295 | { | ||
296 | struct scatterlist *sg = qc->sg; | ||
297 | struct ata_port *ap = qc->ap; | ||
298 | struct adma_port_priv *pp = ap->private_data; | ||
299 | u8 *buf = pp->pkt; | ||
300 | int nelem, i = (2 + buf[3]) * 8; | ||
301 | u8 pFLAGS = pORD | ((qc->tf.flags & ATA_TFLAG_WRITE) ? pDIRO : 0); | ||
302 | |||
303 | for (nelem = 0; nelem < qc->n_elem; nelem++,sg++) { | ||
304 | u32 addr; | ||
305 | u32 len; | ||
306 | |||
307 | addr = (u32)sg_dma_address(sg); | ||
308 | *(__le32 *)(buf + i) = cpu_to_le32(addr); | ||
309 | i += 4; | ||
310 | |||
311 | len = sg_dma_len(sg) >> 3; | ||
312 | *(__le32 *)(buf + i) = cpu_to_le32(len); | ||
313 | i += 4; | ||
314 | |||
315 | if ((nelem + 1) == qc->n_elem) | ||
316 | pFLAGS |= pEND; | ||
317 | buf[i++] = pFLAGS; | ||
318 | buf[i++] = qc->dev->dma_mode & 0xf; | ||
319 | buf[i++] = 0; /* pPKLW */ | ||
320 | buf[i++] = 0; /* reserved */ | ||
321 | |||
322 | *(__le32 *)(buf + i) | ||
323 | = (pFLAGS & pEND) ? 0 : cpu_to_le32(pp->pkt_dma + i + 4); | ||
324 | i += 4; | ||
325 | |||
326 | VPRINTK("PRD[%u] = (0x%lX, 0x%X)\n", nelem, | ||
327 | (unsigned long)addr, len); | ||
328 | } | ||
329 | return i; | ||
330 | } | ||
331 | |||
332 | static void adma_qc_prep(struct ata_queued_cmd *qc) | ||
333 | { | ||
334 | struct adma_port_priv *pp = qc->ap->private_data; | ||
335 | u8 *buf = pp->pkt; | ||
336 | u32 pkt_dma = (u32)pp->pkt_dma; | ||
337 | int i = 0; | ||
338 | |||
339 | VPRINTK("ENTER\n"); | ||
340 | |||
341 | adma_enter_reg_mode(qc->ap); | ||
342 | if (qc->tf.protocol != ATA_PROT_DMA) { | ||
343 | ata_qc_prep(qc); | ||
344 | return; | ||
345 | } | ||
346 | |||
347 | buf[i++] = 0; /* Response flags */ | ||
348 | buf[i++] = 0; /* reserved */ | ||
349 | buf[i++] = cVLD | cDAT | cIEN; | ||
350 | i++; /* cLEN, gets filled in below */ | ||
351 | |||
352 | *(__le32 *)(buf+i) = cpu_to_le32(pkt_dma); /* cNCPB */ | ||
353 | i += 4; /* cNCPB */ | ||
354 | i += 4; /* cPRD, gets filled in below */ | ||
355 | |||
356 | buf[i++] = 0; /* reserved */ | ||
357 | buf[i++] = 0; /* reserved */ | ||
358 | buf[i++] = 0; /* reserved */ | ||
359 | buf[i++] = 0; /* reserved */ | ||
360 | |||
361 | /* ATA registers; must be a multiple of 4 */ | ||
362 | buf[i++] = qc->tf.device; | ||
363 | buf[i++] = ADMA_REGS_DEVICE; | ||
364 | if ((qc->tf.flags & ATA_TFLAG_LBA48)) { | ||
365 | buf[i++] = qc->tf.hob_nsect; | ||
366 | buf[i++] = ADMA_REGS_SECTOR_COUNT; | ||
367 | buf[i++] = qc->tf.hob_lbal; | ||
368 | buf[i++] = ADMA_REGS_LBA_LOW; | ||
369 | buf[i++] = qc->tf.hob_lbam; | ||
370 | buf[i++] = ADMA_REGS_LBA_MID; | ||
371 | buf[i++] = qc->tf.hob_lbah; | ||
372 | buf[i++] = ADMA_REGS_LBA_HIGH; | ||
373 | } | ||
374 | buf[i++] = qc->tf.nsect; | ||
375 | buf[i++] = ADMA_REGS_SECTOR_COUNT; | ||
376 | buf[i++] = qc->tf.lbal; | ||
377 | buf[i++] = ADMA_REGS_LBA_LOW; | ||
378 | buf[i++] = qc->tf.lbam; | ||
379 | buf[i++] = ADMA_REGS_LBA_MID; | ||
380 | buf[i++] = qc->tf.lbah; | ||
381 | buf[i++] = ADMA_REGS_LBA_HIGH; | ||
382 | buf[i++] = 0; | ||
383 | buf[i++] = ADMA_REGS_CONTROL; | ||
384 | buf[i++] = rIGN; | ||
385 | buf[i++] = 0; | ||
386 | buf[i++] = qc->tf.command; | ||
387 | buf[i++] = ADMA_REGS_COMMAND | rEND; | ||
388 | |||
389 | buf[3] = (i >> 3) - 2; /* cLEN */ | ||
390 | *(__le32 *)(buf+8) = cpu_to_le32(pkt_dma + i); /* cPRD */ | ||
391 | |||
392 | i = adma_fill_sg(qc); | ||
393 | wmb(); /* flush PRDs and pkt to memory */ | ||
394 | #if 0 | ||
395 | /* dump out CPB + PRDs for debug */ | ||
396 | { | ||
397 | int j, len = 0; | ||
398 | static char obuf[2048]; | ||
399 | for (j = 0; j < i; ++j) { | ||
400 | len += sprintf(obuf+len, "%02x ", buf[j]); | ||
401 | if ((j & 7) == 7) { | ||
402 | printk("%s\n", obuf); | ||
403 | len = 0; | ||
404 | } | ||
405 | } | ||
406 | if (len) | ||
407 | printk("%s\n", obuf); | ||
408 | } | ||
409 | #endif | ||
410 | } | ||
411 | |||
412 | static inline void adma_packet_start(struct ata_queued_cmd *qc) | ||
413 | { | ||
414 | struct ata_port *ap = qc->ap; | ||
415 | void __iomem *chan = ADMA_REGS(ap->host_set->mmio_base, ap->port_no); | ||
416 | |||
417 | VPRINTK("ENTER, ap %p\n", ap); | ||
418 | |||
419 | /* fire up the ADMA engine */ | ||
420 | writew(aPIOMD4 | aGO, chan + ADMA_CONTROL); | ||
421 | } | ||
422 | |||
423 | static int adma_qc_issue(struct ata_queued_cmd *qc) | ||
424 | { | ||
425 | struct adma_port_priv *pp = qc->ap->private_data; | ||
426 | |||
427 | switch (qc->tf.protocol) { | ||
428 | case ATA_PROT_DMA: | ||
429 | pp->state = adma_state_pkt; | ||
430 | adma_packet_start(qc); | ||
431 | return 0; | ||
432 | |||
433 | case ATA_PROT_ATAPI_DMA: | ||
434 | BUG(); | ||
435 | break; | ||
436 | |||
437 | default: | ||
438 | break; | ||
439 | } | ||
440 | |||
441 | pp->state = adma_state_mmio; | ||
442 | return ata_qc_issue_prot(qc); | ||
443 | } | ||
444 | |||
445 | static inline unsigned int adma_intr_pkt(struct ata_host_set *host_set) | ||
446 | { | ||
447 | unsigned int handled = 0, port_no; | ||
448 | u8 __iomem *mmio_base = host_set->mmio_base; | ||
449 | |||
450 | for (port_no = 0; port_no < host_set->n_ports; ++port_no) { | ||
451 | struct ata_port *ap = host_set->ports[port_no]; | ||
452 | struct adma_port_priv *pp; | ||
453 | struct ata_queued_cmd *qc; | ||
454 | void __iomem *chan = ADMA_REGS(mmio_base, port_no); | ||
455 | u8 drv_stat, status = readb(chan + ADMA_STATUS); | ||
456 | |||
457 | if (status == 0) | ||
458 | continue; | ||
459 | handled = 1; | ||
460 | adma_enter_reg_mode(ap); | ||
461 | if ((ap->flags & ATA_FLAG_PORT_DISABLED)) | ||
462 | continue; | ||
463 | pp = ap->private_data; | ||
464 | if (!pp || pp->state != adma_state_pkt) | ||
465 | continue; | ||
466 | qc = ata_qc_from_tag(ap, ap->active_tag); | ||
467 | drv_stat = 0; | ||
468 | if ((status & (aPERR | aPSD | aUIRQ))) | ||
469 | drv_stat = ATA_ERR; | ||
470 | else if (pp->pkt[0] != cDONE) | ||
471 | drv_stat = ATA_ERR; | ||
472 | ata_qc_complete(qc, drv_stat); | ||
473 | } | ||
474 | return handled; | ||
475 | } | ||
476 | |||
477 | static inline unsigned int adma_intr_mmio(struct ata_host_set *host_set) | ||
478 | { | ||
479 | unsigned int handled = 0, port_no; | ||
480 | |||
481 | for (port_no = 0; port_no < host_set->n_ports; ++port_no) { | ||
482 | struct ata_port *ap; | ||
483 | ap = host_set->ports[port_no]; | ||
484 | if (ap && (!(ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR)))) { | ||
485 | struct ata_queued_cmd *qc; | ||
486 | struct adma_port_priv *pp = ap->private_data; | ||
487 | if (!pp || pp->state != adma_state_mmio) | ||
488 | continue; | ||
489 | qc = ata_qc_from_tag(ap, ap->active_tag); | ||
490 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) { | ||
491 | |||
492 | /* check main status, clearing INTRQ */ | ||
493 | u8 status = ata_chk_status(ap); | ||
494 | if ((status & ATA_BUSY)) | ||
495 | continue; | ||
496 | DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n", | ||
497 | ap->id, qc->tf.protocol, status); | ||
498 | |||
499 | /* complete taskfile transaction */ | ||
500 | pp->state = adma_state_idle; | ||
501 | ata_qc_complete(qc, status); | ||
502 | handled = 1; | ||
503 | } | ||
504 | } | ||
505 | } | ||
506 | return handled; | ||
507 | } | ||
508 | |||
509 | static irqreturn_t adma_intr(int irq, void *dev_instance, struct pt_regs *regs) | ||
510 | { | ||
511 | struct ata_host_set *host_set = dev_instance; | ||
512 | unsigned int handled = 0; | ||
513 | |||
514 | VPRINTK("ENTER\n"); | ||
515 | |||
516 | spin_lock(&host_set->lock); | ||
517 | handled = adma_intr_pkt(host_set) | adma_intr_mmio(host_set); | ||
518 | spin_unlock(&host_set->lock); | ||
519 | |||
520 | VPRINTK("EXIT\n"); | ||
521 | |||
522 | return IRQ_RETVAL(handled); | ||
523 | } | ||
524 | |||
525 | static void adma_ata_setup_port(struct ata_ioports *port, unsigned long base) | ||
526 | { | ||
527 | port->cmd_addr = | ||
528 | port->data_addr = base + 0x000; | ||
529 | port->error_addr = | ||
530 | port->feature_addr = base + 0x004; | ||
531 | port->nsect_addr = base + 0x008; | ||
532 | port->lbal_addr = base + 0x00c; | ||
533 | port->lbam_addr = base + 0x010; | ||
534 | port->lbah_addr = base + 0x014; | ||
535 | port->device_addr = base + 0x018; | ||
536 | port->status_addr = | ||
537 | port->command_addr = base + 0x01c; | ||
538 | port->altstatus_addr = | ||
539 | port->ctl_addr = base + 0x038; | ||
540 | } | ||
541 | |||
542 | static int adma_port_start(struct ata_port *ap) | ||
543 | { | ||
544 | struct device *dev = ap->host_set->dev; | ||
545 | struct adma_port_priv *pp; | ||
546 | int rc; | ||
547 | |||
548 | rc = ata_port_start(ap); | ||
549 | if (rc) | ||
550 | return rc; | ||
551 | adma_enter_reg_mode(ap); | ||
552 | rc = -ENOMEM; | ||
553 | pp = kcalloc(1, sizeof(*pp), GFP_KERNEL); | ||
554 | if (!pp) | ||
555 | goto err_out; | ||
556 | pp->pkt = dma_alloc_coherent(dev, ADMA_PKT_BYTES, &pp->pkt_dma, | ||
557 | GFP_KERNEL); | ||
558 | if (!pp->pkt) | ||
559 | goto err_out_kfree; | ||
560 | /* paranoia? */ | ||
561 | if ((pp->pkt_dma & 7) != 0) { | ||
562 | printk("bad alignment for pp->pkt_dma: %08x\n", | ||
563 | (u32)pp->pkt_dma); | ||
564 | goto err_out_kfree2; | ||
565 | } | ||
566 | memset(pp->pkt, 0, ADMA_PKT_BYTES); | ||
567 | ap->private_data = pp; | ||
568 | adma_reinit_engine(ap); | ||
569 | return 0; | ||
570 | |||
571 | err_out_kfree2: | ||
572 | kfree(pp); | ||
573 | err_out_kfree: | ||
574 | kfree(pp); | ||
575 | err_out: | ||
576 | ata_port_stop(ap); | ||
577 | return rc; | ||
578 | } | ||
579 | |||
580 | static void adma_port_stop(struct ata_port *ap) | ||
581 | { | ||
582 | struct device *dev = ap->host_set->dev; | ||
583 | struct adma_port_priv *pp = ap->private_data; | ||
584 | |||
585 | adma_reset_engine(ADMA_REGS(ap->host_set->mmio_base, ap->port_no)); | ||
586 | if (pp != NULL) { | ||
587 | ap->private_data = NULL; | ||
588 | if (pp->pkt != NULL) | ||
589 | dma_free_coherent(dev, ADMA_PKT_BYTES, | ||
590 | pp->pkt, pp->pkt_dma); | ||
591 | kfree(pp); | ||
592 | } | ||
593 | ata_port_stop(ap); | ||
594 | } | ||
595 | |||
596 | static void adma_host_stop(struct ata_host_set *host_set) | ||
597 | { | ||
598 | unsigned int port_no; | ||
599 | |||
600 | for (port_no = 0; port_no < ADMA_PORTS; ++port_no) | ||
601 | adma_reset_engine(ADMA_REGS(host_set->mmio_base, port_no)); | ||
602 | |||
603 | ata_pci_host_stop(host_set); | ||
604 | } | ||
605 | |||
606 | static void adma_host_init(unsigned int chip_id, | ||
607 | struct ata_probe_ent *probe_ent) | ||
608 | { | ||
609 | unsigned int port_no; | ||
610 | void __iomem *mmio_base = probe_ent->mmio_base; | ||
611 | |||
612 | /* enable/lock aGO operation */ | ||
613 | writeb(7, mmio_base + ADMA_MODE_LOCK); | ||
614 | |||
615 | /* reset the ADMA logic */ | ||
616 | for (port_no = 0; port_no < ADMA_PORTS; ++port_no) | ||
617 | adma_reset_engine(ADMA_REGS(mmio_base, port_no)); | ||
618 | } | ||
619 | |||
620 | static int adma_set_dma_masks(struct pci_dev *pdev, void __iomem *mmio_base) | ||
621 | { | ||
622 | int rc; | ||
623 | |||
624 | rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); | ||
625 | if (rc) { | ||
626 | printk(KERN_ERR DRV_NAME | ||
627 | "(%s): 32-bit DMA enable failed\n", | ||
628 | pci_name(pdev)); | ||
629 | return rc; | ||
630 | } | ||
631 | rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); | ||
632 | if (rc) { | ||
633 | printk(KERN_ERR DRV_NAME | ||
634 | "(%s): 32-bit consistent DMA enable failed\n", | ||
635 | pci_name(pdev)); | ||
636 | return rc; | ||
637 | } | ||
638 | return 0; | ||
639 | } | ||
640 | |||
641 | static int adma_ata_init_one(struct pci_dev *pdev, | ||
642 | const struct pci_device_id *ent) | ||
643 | { | ||
644 | static int printed_version; | ||
645 | struct ata_probe_ent *probe_ent = NULL; | ||
646 | void __iomem *mmio_base; | ||
647 | unsigned int board_idx = (unsigned int) ent->driver_data; | ||
648 | int rc, port_no; | ||
649 | |||
650 | if (!printed_version++) | ||
651 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); | ||
652 | |||
653 | rc = pci_enable_device(pdev); | ||
654 | if (rc) | ||
655 | return rc; | ||
656 | |||
657 | rc = pci_request_regions(pdev, DRV_NAME); | ||
658 | if (rc) | ||
659 | goto err_out; | ||
660 | |||
661 | if ((pci_resource_flags(pdev, 4) & IORESOURCE_MEM) == 0) { | ||
662 | rc = -ENODEV; | ||
663 | goto err_out_regions; | ||
664 | } | ||
665 | |||
666 | mmio_base = pci_iomap(pdev, 4, 0); | ||
667 | if (mmio_base == NULL) { | ||
668 | rc = -ENOMEM; | ||
669 | goto err_out_regions; | ||
670 | } | ||
671 | |||
672 | rc = adma_set_dma_masks(pdev, mmio_base); | ||
673 | if (rc) | ||
674 | goto err_out_iounmap; | ||
675 | |||
676 | probe_ent = kcalloc(1, sizeof(*probe_ent), GFP_KERNEL); | ||
677 | if (probe_ent == NULL) { | ||
678 | rc = -ENOMEM; | ||
679 | goto err_out_iounmap; | ||
680 | } | ||
681 | |||
682 | probe_ent->dev = pci_dev_to_dev(pdev); | ||
683 | INIT_LIST_HEAD(&probe_ent->node); | ||
684 | |||
685 | probe_ent->sht = adma_port_info[board_idx].sht; | ||
686 | probe_ent->host_flags = adma_port_info[board_idx].host_flags; | ||
687 | probe_ent->pio_mask = adma_port_info[board_idx].pio_mask; | ||
688 | probe_ent->mwdma_mask = adma_port_info[board_idx].mwdma_mask; | ||
689 | probe_ent->udma_mask = adma_port_info[board_idx].udma_mask; | ||
690 | probe_ent->port_ops = adma_port_info[board_idx].port_ops; | ||
691 | |||
692 | probe_ent->irq = pdev->irq; | ||
693 | probe_ent->irq_flags = SA_SHIRQ; | ||
694 | probe_ent->mmio_base = mmio_base; | ||
695 | probe_ent->n_ports = ADMA_PORTS; | ||
696 | |||
697 | for (port_no = 0; port_no < probe_ent->n_ports; ++port_no) { | ||
698 | adma_ata_setup_port(&probe_ent->port[port_no], | ||
699 | ADMA_ATA_REGS((unsigned long)mmio_base, port_no)); | ||
700 | } | ||
701 | |||
702 | pci_set_master(pdev); | ||
703 | |||
704 | /* initialize adapter */ | ||
705 | adma_host_init(board_idx, probe_ent); | ||
706 | |||
707 | rc = ata_device_add(probe_ent); | ||
708 | kfree(probe_ent); | ||
709 | if (rc != ADMA_PORTS) | ||
710 | goto err_out_iounmap; | ||
711 | return 0; | ||
712 | |||
713 | err_out_iounmap: | ||
714 | pci_iounmap(pdev, mmio_base); | ||
715 | err_out_regions: | ||
716 | pci_release_regions(pdev); | ||
717 | err_out: | ||
718 | pci_disable_device(pdev); | ||
719 | return rc; | ||
720 | } | ||
721 | |||
722 | static int __init adma_ata_init(void) | ||
723 | { | ||
724 | return pci_module_init(&adma_ata_pci_driver); | ||
725 | } | ||
726 | |||
727 | static void __exit adma_ata_exit(void) | ||
728 | { | ||
729 | pci_unregister_driver(&adma_ata_pci_driver); | ||
730 | } | ||
731 | |||
732 | MODULE_AUTHOR("Mark Lord"); | ||
733 | MODULE_DESCRIPTION("Pacific Digital Corporation ADMA low-level driver"); | ||
734 | MODULE_LICENSE("GPL"); | ||
735 | MODULE_DEVICE_TABLE(pci, adma_ata_pci_tbl); | ||
736 | MODULE_VERSION(DRV_VERSION); | ||
737 | |||
738 | module_init(adma_ata_init); | ||
739 | module_exit(adma_ata_exit); | ||
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index a917ab7475ac..1fd5fc6d0fe3 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c | |||
@@ -1119,6 +1119,36 @@ static inline void update_can_queue(struct Scsi_Host *host, u_int in_ptr, u_int | |||
1119 | host->sg_tablesize = QLOGICPTI_MAX_SG(num_free); | 1119 | host->sg_tablesize = QLOGICPTI_MAX_SG(num_free); |
1120 | } | 1120 | } |
1121 | 1121 | ||
1122 | static unsigned int scsi_rbuf_get(struct scsi_cmnd *cmd, unsigned char **buf_out) | ||
1123 | { | ||
1124 | unsigned char *buf; | ||
1125 | unsigned int buflen; | ||
1126 | |||
1127 | if (cmd->use_sg) { | ||
1128 | struct scatterlist *sg; | ||
1129 | |||
1130 | sg = (struct scatterlist *) cmd->request_buffer; | ||
1131 | buf = kmap_atomic(sg->page, KM_IRQ0) + sg->offset; | ||
1132 | buflen = sg->length; | ||
1133 | } else { | ||
1134 | buf = cmd->request_buffer; | ||
1135 | buflen = cmd->request_bufflen; | ||
1136 | } | ||
1137 | |||
1138 | *buf_out = buf; | ||
1139 | return buflen; | ||
1140 | } | ||
1141 | |||
1142 | static void scsi_rbuf_put(struct scsi_cmnd *cmd, unsigned char *buf) | ||
1143 | { | ||
1144 | if (cmd->use_sg) { | ||
1145 | struct scatterlist *sg; | ||
1146 | |||
1147 | sg = (struct scatterlist *) cmd->request_buffer; | ||
1148 | kunmap_atomic(buf - sg->offset, KM_IRQ0); | ||
1149 | } | ||
1150 | } | ||
1151 | |||
1122 | /* | 1152 | /* |
1123 | * Until we scan the entire bus with inquiries, go throught this fella... | 1153 | * Until we scan the entire bus with inquiries, go throught this fella... |
1124 | */ | 1154 | */ |
@@ -1145,11 +1175,9 @@ static void ourdone(struct scsi_cmnd *Cmnd) | |||
1145 | int ok = host_byte(Cmnd->result) == DID_OK; | 1175 | int ok = host_byte(Cmnd->result) == DID_OK; |
1146 | if (Cmnd->cmnd[0] == 0x12 && ok) { | 1176 | if (Cmnd->cmnd[0] == 0x12 && ok) { |
1147 | unsigned char *iqd; | 1177 | unsigned char *iqd; |
1178 | unsigned int iqd_len; | ||
1148 | 1179 | ||
1149 | if (Cmnd->use_sg != 0) | 1180 | iqd_len = scsi_rbuf_get(Cmnd, &iqd); |
1150 | BUG(); | ||
1151 | |||
1152 | iqd = ((unsigned char *)Cmnd->buffer); | ||
1153 | 1181 | ||
1154 | /* tags handled in midlayer */ | 1182 | /* tags handled in midlayer */ |
1155 | /* enable sync mode? */ | 1183 | /* enable sync mode? */ |
@@ -1163,6 +1191,9 @@ static void ourdone(struct scsi_cmnd *Cmnd) | |||
1163 | if (iqd[7] & 0x20) { | 1191 | if (iqd[7] & 0x20) { |
1164 | qpti->dev_param[tgt].device_flags |= 0x20; | 1192 | qpti->dev_param[tgt].device_flags |= 0x20; |
1165 | } | 1193 | } |
1194 | |||
1195 | scsi_rbuf_put(Cmnd, iqd); | ||
1196 | |||
1166 | qpti->sbits |= (1 << tgt); | 1197 | qpti->sbits |= (1 << tgt); |
1167 | } else if (!ok) { | 1198 | } else if (!ok) { |
1168 | qpti->sbits |= (1 << tgt); | 1199 | qpti->sbits |= (1 << tgt); |
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c new file mode 100644 index 000000000000..19857814d69f --- /dev/null +++ b/drivers/scsi/sata_sil24.c | |||
@@ -0,0 +1,875 @@ | |||
1 | /* | ||
2 | * sata_sil24.c - Driver for Silicon Image 3124/3132 SATA-2 controllers | ||
3 | * | ||
4 | * Copyright 2005 Tejun Heo | ||
5 | * | ||
6 | * Based on preview driver from Silicon Image. | ||
7 | * | ||
8 | * NOTE: No NCQ/ATAPI support yet. The preview driver didn't support | ||
9 | * NCQ nor ATAPI, and, unfortunately, I couldn't find out how to make | ||
10 | * those work. Enabling those shouldn't be difficult. Basic | ||
11 | * structure is all there (in libata-dev tree). If you have any | ||
12 | * information about this hardware, please contact me or linux-ide. | ||
13 | * Info is needed on... | ||
14 | * | ||
15 | * - How to issue tagged commands and turn on sactive on issue accordingly. | ||
16 | * - Where to put an ATAPI command and how to tell the device to send it. | ||
17 | * - How to enable/use 64bit. | ||
18 | * | ||
19 | * This program is free software; you can redistribute it and/or modify it | ||
20 | * under the terms of the GNU General Public License as published by the | ||
21 | * Free Software Foundation; either version 2, or (at your option) any | ||
22 | * later version. | ||
23 | * | ||
24 | * This program is distributed in the hope that it will be useful, but | ||
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
27 | * General Public License for more details. | ||
28 | * | ||
29 | */ | ||
30 | |||
31 | #include <linux/kernel.h> | ||
32 | #include <linux/module.h> | ||
33 | #include <linux/pci.h> | ||
34 | #include <linux/blkdev.h> | ||
35 | #include <linux/delay.h> | ||
36 | #include <linux/interrupt.h> | ||
37 | #include <linux/dma-mapping.h> | ||
38 | #include <scsi/scsi_host.h> | ||
39 | #include "scsi.h" | ||
40 | #include <linux/libata.h> | ||
41 | #include <asm/io.h> | ||
42 | |||
43 | #define DRV_NAME "sata_sil24" | ||
44 | #define DRV_VERSION "0.22" /* Silicon Image's preview driver was 0.10 */ | ||
45 | |||
46 | /* | ||
47 | * Port request block (PRB) 32 bytes | ||
48 | */ | ||
49 | struct sil24_prb { | ||
50 | u16 ctrl; | ||
51 | u16 prot; | ||
52 | u32 rx_cnt; | ||
53 | u8 fis[6 * 4]; | ||
54 | }; | ||
55 | |||
56 | /* | ||
57 | * Scatter gather entry (SGE) 16 bytes | ||
58 | */ | ||
59 | struct sil24_sge { | ||
60 | u64 addr; | ||
61 | u32 cnt; | ||
62 | u32 flags; | ||
63 | }; | ||
64 | |||
65 | /* | ||
66 | * Port multiplier | ||
67 | */ | ||
68 | struct sil24_port_multiplier { | ||
69 | u32 diag; | ||
70 | u32 sactive; | ||
71 | }; | ||
72 | |||
73 | enum { | ||
74 | /* | ||
75 | * Global controller registers (128 bytes @ BAR0) | ||
76 | */ | ||
77 | /* 32 bit regs */ | ||
78 | HOST_SLOT_STAT = 0x00, /* 32 bit slot stat * 4 */ | ||
79 | HOST_CTRL = 0x40, | ||
80 | HOST_IRQ_STAT = 0x44, | ||
81 | HOST_PHY_CFG = 0x48, | ||
82 | HOST_BIST_CTRL = 0x50, | ||
83 | HOST_BIST_PTRN = 0x54, | ||
84 | HOST_BIST_STAT = 0x58, | ||
85 | HOST_MEM_BIST_STAT = 0x5c, | ||
86 | HOST_FLASH_CMD = 0x70, | ||
87 | /* 8 bit regs */ | ||
88 | HOST_FLASH_DATA = 0x74, | ||
89 | HOST_TRANSITION_DETECT = 0x75, | ||
90 | HOST_GPIO_CTRL = 0x76, | ||
91 | HOST_I2C_ADDR = 0x78, /* 32 bit */ | ||
92 | HOST_I2C_DATA = 0x7c, | ||
93 | HOST_I2C_XFER_CNT = 0x7e, | ||
94 | HOST_I2C_CTRL = 0x7f, | ||
95 | |||
96 | /* HOST_SLOT_STAT bits */ | ||
97 | HOST_SSTAT_ATTN = (1 << 31), | ||
98 | |||
99 | /* | ||
100 | * Port registers | ||
101 | * (8192 bytes @ +0x0000, +0x2000, +0x4000 and +0x6000 @ BAR2) | ||
102 | */ | ||
103 | PORT_REGS_SIZE = 0x2000, | ||
104 | PORT_PRB = 0x0000, /* (32 bytes PRB + 16 bytes SGEs * 6) * 31 (3968 bytes) */ | ||
105 | |||
106 | PORT_PM = 0x0f80, /* 8 bytes PM * 16 (128 bytes) */ | ||
107 | /* 32 bit regs */ | ||
108 | PORT_CTRL_STAT = 0x1000, /* write: ctrl-set, read: stat */ | ||
109 | PORT_CTRL_CLR = 0x1004, /* write: ctrl-clear */ | ||
110 | PORT_IRQ_STAT = 0x1008, /* high: status, low: interrupt */ | ||
111 | PORT_IRQ_ENABLE_SET = 0x1010, /* write: enable-set */ | ||
112 | PORT_IRQ_ENABLE_CLR = 0x1014, /* write: enable-clear */ | ||
113 | PORT_ACTIVATE_UPPER_ADDR= 0x101c, | ||
114 | PORT_EXEC_FIFO = 0x1020, /* command execution fifo */ | ||
115 | PORT_CMD_ERR = 0x1024, /* command error number */ | ||
116 | PORT_FIS_CFG = 0x1028, | ||
117 | PORT_FIFO_THRES = 0x102c, | ||
118 | /* 16 bit regs */ | ||
119 | PORT_DECODE_ERR_CNT = 0x1040, | ||
120 | PORT_DECODE_ERR_THRESH = 0x1042, | ||
121 | PORT_CRC_ERR_CNT = 0x1044, | ||
122 | PORT_CRC_ERR_THRESH = 0x1046, | ||
123 | PORT_HSHK_ERR_CNT = 0x1048, | ||
124 | PORT_HSHK_ERR_THRESH = 0x104a, | ||
125 | /* 32 bit regs */ | ||
126 | PORT_PHY_CFG = 0x1050, | ||
127 | PORT_SLOT_STAT = 0x1800, | ||
128 | PORT_CMD_ACTIVATE = 0x1c00, /* 64 bit cmd activate * 31 (248 bytes) */ | ||
129 | PORT_EXEC_DIAG = 0x1e00, /* 32bit exec diag * 16 (64 bytes, 0-10 used on 3124) */ | ||
130 | PORT_PSD_DIAG = 0x1e40, /* 32bit psd diag * 16 (64 bytes, 0-8 used on 3124) */ | ||
131 | PORT_SCONTROL = 0x1f00, | ||
132 | PORT_SSTATUS = 0x1f04, | ||
133 | PORT_SERROR = 0x1f08, | ||
134 | PORT_SACTIVE = 0x1f0c, | ||
135 | |||
136 | /* PORT_CTRL_STAT bits */ | ||
137 | PORT_CS_PORT_RST = (1 << 0), /* port reset */ | ||
138 | PORT_CS_DEV_RST = (1 << 1), /* device reset */ | ||
139 | PORT_CS_INIT = (1 << 2), /* port initialize */ | ||
140 | PORT_CS_IRQ_WOC = (1 << 3), /* interrupt write one to clear */ | ||
141 | PORT_CS_RESUME = (1 << 6), /* port resume */ | ||
142 | PORT_CS_32BIT_ACTV = (1 << 10), /* 32-bit activation */ | ||
143 | PORT_CS_PM_EN = (1 << 13), /* port multiplier enable */ | ||
144 | PORT_CS_RDY = (1 << 31), /* port ready to accept commands */ | ||
145 | |||
146 | /* PORT_IRQ_STAT/ENABLE_SET/CLR */ | ||
147 | /* bits[11:0] are masked */ | ||
148 | PORT_IRQ_COMPLETE = (1 << 0), /* command(s) completed */ | ||
149 | PORT_IRQ_ERROR = (1 << 1), /* command execution error */ | ||
150 | PORT_IRQ_PORTRDY_CHG = (1 << 2), /* port ready change */ | ||
151 | PORT_IRQ_PWR_CHG = (1 << 3), /* power management change */ | ||
152 | PORT_IRQ_PHYRDY_CHG = (1 << 4), /* PHY ready change */ | ||
153 | PORT_IRQ_COMWAKE = (1 << 5), /* COMWAKE received */ | ||
154 | PORT_IRQ_UNK_FIS = (1 << 6), /* Unknown FIS received */ | ||
155 | PORT_IRQ_SDB_FIS = (1 << 11), /* SDB FIS received */ | ||
156 | |||
157 | /* bits[27:16] are unmasked (raw) */ | ||
158 | PORT_IRQ_RAW_SHIFT = 16, | ||
159 | PORT_IRQ_MASKED_MASK = 0x7ff, | ||
160 | PORT_IRQ_RAW_MASK = (0x7ff << PORT_IRQ_RAW_SHIFT), | ||
161 | |||
162 | /* ENABLE_SET/CLR specific, intr steering - 2 bit field */ | ||
163 | PORT_IRQ_STEER_SHIFT = 30, | ||
164 | PORT_IRQ_STEER_MASK = (3 << PORT_IRQ_STEER_SHIFT), | ||
165 | |||
166 | /* PORT_CMD_ERR constants */ | ||
167 | PORT_CERR_DEV = 1, /* Error bit in D2H Register FIS */ | ||
168 | PORT_CERR_SDB = 2, /* Error bit in SDB FIS */ | ||
169 | PORT_CERR_DATA = 3, /* Error in data FIS not detected by dev */ | ||
170 | PORT_CERR_SEND = 4, /* Initial cmd FIS transmission failure */ | ||
171 | PORT_CERR_INCONSISTENT = 5, /* Protocol mismatch */ | ||
172 | PORT_CERR_DIRECTION = 6, /* Data direction mismatch */ | ||
173 | PORT_CERR_UNDERRUN = 7, /* Ran out of SGEs while writing */ | ||
174 | PORT_CERR_OVERRUN = 8, /* Ran out of SGEs while reading */ | ||
175 | PORT_CERR_PKT_PROT = 11, /* DIR invalid in 1st PIO setup of ATAPI */ | ||
176 | PORT_CERR_SGT_BOUNDARY = 16, /* PLD ecode 00 - SGT not on qword boundary */ | ||
177 | PORT_CERR_SGT_TGTABRT = 17, /* PLD ecode 01 - target abort */ | ||
178 | PORT_CERR_SGT_MSTABRT = 18, /* PLD ecode 10 - master abort */ | ||
179 | PORT_CERR_SGT_PCIPERR = 19, /* PLD ecode 11 - PCI parity err while fetching SGT */ | ||
180 | PORT_CERR_CMD_BOUNDARY = 24, /* ctrl[15:13] 001 - PRB not on qword boundary */ | ||
181 | PORT_CERR_CMD_TGTABRT = 25, /* ctrl[15:13] 010 - target abort */ | ||
182 | PORT_CERR_CMD_MSTABRT = 26, /* ctrl[15:13] 100 - master abort */ | ||
183 | PORT_CERR_CMD_PCIPERR = 27, /* ctrl[15:13] 110 - PCI parity err while fetching PRB */ | ||
184 | PORT_CERR_XFR_UNDEF = 32, /* PSD ecode 00 - undefined */ | ||
185 | PORT_CERR_XFR_TGTABRT = 33, /* PSD ecode 01 - target abort */ | ||
186 | PORT_CERR_XFR_MSGABRT = 34, /* PSD ecode 10 - master abort */ | ||
187 | PORT_CERR_XFR_PCIPERR = 35, /* PSD ecode 11 - PCI prity err during transfer */ | ||
188 | PORT_CERR_SENDSERVICE = 36, /* FIS received while sending service */ | ||
189 | |||
190 | /* | ||
191 | * Other constants | ||
192 | */ | ||
193 | SGE_TRM = (1 << 31), /* Last SGE in chain */ | ||
194 | PRB_SOFT_RST = (1 << 7), /* Soft reset request (ign BSY?) */ | ||
195 | |||
196 | /* board id */ | ||
197 | BID_SIL3124 = 0, | ||
198 | BID_SIL3132 = 1, | ||
199 | BID_SIL3131 = 2, | ||
200 | |||
201 | IRQ_STAT_4PORTS = 0xf, | ||
202 | }; | ||
203 | |||
204 | struct sil24_cmd_block { | ||
205 | struct sil24_prb prb; | ||
206 | struct sil24_sge sge[LIBATA_MAX_PRD]; | ||
207 | }; | ||
208 | |||
209 | /* | ||
210 | * ap->private_data | ||
211 | * | ||
212 | * The preview driver always returned 0 for status. We emulate it | ||
213 | * here from the previous interrupt. | ||
214 | */ | ||
215 | struct sil24_port_priv { | ||
216 | struct sil24_cmd_block *cmd_block; /* 32 cmd blocks */ | ||
217 | dma_addr_t cmd_block_dma; /* DMA base addr for them */ | ||
218 | struct ata_taskfile tf; /* Cached taskfile registers */ | ||
219 | }; | ||
220 | |||
221 | /* ap->host_set->private_data */ | ||
222 | struct sil24_host_priv { | ||
223 | void *host_base; /* global controller control (128 bytes @BAR0) */ | ||
224 | void *port_base; /* port registers (4 * 8192 bytes @BAR2) */ | ||
225 | }; | ||
226 | |||
227 | static u8 sil24_check_status(struct ata_port *ap); | ||
228 | static u8 sil24_check_err(struct ata_port *ap); | ||
229 | static u32 sil24_scr_read(struct ata_port *ap, unsigned sc_reg); | ||
230 | static void sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val); | ||
231 | static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf); | ||
232 | static void sil24_phy_reset(struct ata_port *ap); | ||
233 | static void sil24_qc_prep(struct ata_queued_cmd *qc); | ||
234 | static int sil24_qc_issue(struct ata_queued_cmd *qc); | ||
235 | static void sil24_irq_clear(struct ata_port *ap); | ||
236 | static void sil24_eng_timeout(struct ata_port *ap); | ||
237 | static irqreturn_t sil24_interrupt(int irq, void *dev_instance, struct pt_regs *regs); | ||
238 | static int sil24_port_start(struct ata_port *ap); | ||
239 | static void sil24_port_stop(struct ata_port *ap); | ||
240 | static void sil24_host_stop(struct ata_host_set *host_set); | ||
241 | static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); | ||
242 | |||
243 | static struct pci_device_id sil24_pci_tbl[] = { | ||
244 | { 0x1095, 0x3124, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3124 }, | ||
245 | { 0x1095, 0x3132, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3132 }, | ||
246 | { 0x1095, 0x3131, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3131 }, | ||
247 | { 0x1095, 0x3531, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3131 }, | ||
248 | { } /* terminate list */ | ||
249 | }; | ||
250 | |||
251 | static struct pci_driver sil24_pci_driver = { | ||
252 | .name = DRV_NAME, | ||
253 | .id_table = sil24_pci_tbl, | ||
254 | .probe = sil24_init_one, | ||
255 | .remove = ata_pci_remove_one, /* safe? */ | ||
256 | }; | ||
257 | |||
258 | static Scsi_Host_Template sil24_sht = { | ||
259 | .module = THIS_MODULE, | ||
260 | .name = DRV_NAME, | ||
261 | .ioctl = ata_scsi_ioctl, | ||
262 | .queuecommand = ata_scsi_queuecmd, | ||
263 | .eh_strategy_handler = ata_scsi_error, | ||
264 | .can_queue = ATA_DEF_QUEUE, | ||
265 | .this_id = ATA_SHT_THIS_ID, | ||
266 | .sg_tablesize = LIBATA_MAX_PRD, | ||
267 | .max_sectors = ATA_MAX_SECTORS, | ||
268 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, | ||
269 | .emulated = ATA_SHT_EMULATED, | ||
270 | .use_clustering = ATA_SHT_USE_CLUSTERING, | ||
271 | .proc_name = DRV_NAME, | ||
272 | .dma_boundary = ATA_DMA_BOUNDARY, | ||
273 | .slave_configure = ata_scsi_slave_config, | ||
274 | .bios_param = ata_std_bios_param, | ||
275 | .ordered_flush = 1, /* NCQ not supported yet */ | ||
276 | }; | ||
277 | |||
278 | static struct ata_port_operations sil24_ops = { | ||
279 | .port_disable = ata_port_disable, | ||
280 | |||
281 | .check_status = sil24_check_status, | ||
282 | .check_altstatus = sil24_check_status, | ||
283 | .check_err = sil24_check_err, | ||
284 | .dev_select = ata_noop_dev_select, | ||
285 | |||
286 | .tf_read = sil24_tf_read, | ||
287 | |||
288 | .phy_reset = sil24_phy_reset, | ||
289 | |||
290 | .qc_prep = sil24_qc_prep, | ||
291 | .qc_issue = sil24_qc_issue, | ||
292 | |||
293 | .eng_timeout = sil24_eng_timeout, | ||
294 | |||
295 | .irq_handler = sil24_interrupt, | ||
296 | .irq_clear = sil24_irq_clear, | ||
297 | |||
298 | .scr_read = sil24_scr_read, | ||
299 | .scr_write = sil24_scr_write, | ||
300 | |||
301 | .port_start = sil24_port_start, | ||
302 | .port_stop = sil24_port_stop, | ||
303 | .host_stop = sil24_host_stop, | ||
304 | }; | ||
305 | |||
306 | /* | ||
307 | * Use bits 30-31 of host_flags to encode available port numbers. | ||
308 | * Current maxium is 4. | ||
309 | */ | ||
310 | #define SIL24_NPORTS2FLAG(nports) ((((unsigned)(nports) - 1) & 0x3) << 30) | ||
311 | #define SIL24_FLAG2NPORTS(flag) ((((flag) >> 30) & 0x3) + 1) | ||
312 | |||
313 | static struct ata_port_info sil24_port_info[] = { | ||
314 | /* sil_3124 */ | ||
315 | { | ||
316 | .sht = &sil24_sht, | ||
317 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | ||
318 | ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | | ||
319 | ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(4), | ||
320 | .pio_mask = 0x1f, /* pio0-4 */ | ||
321 | .mwdma_mask = 0x07, /* mwdma0-2 */ | ||
322 | .udma_mask = 0x3f, /* udma0-5 */ | ||
323 | .port_ops = &sil24_ops, | ||
324 | }, | ||
325 | /* sil_3132 */ | ||
326 | { | ||
327 | .sht = &sil24_sht, | ||
328 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | ||
329 | ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | | ||
330 | ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(2), | ||
331 | .pio_mask = 0x1f, /* pio0-4 */ | ||
332 | .mwdma_mask = 0x07, /* mwdma0-2 */ | ||
333 | .udma_mask = 0x3f, /* udma0-5 */ | ||
334 | .port_ops = &sil24_ops, | ||
335 | }, | ||
336 | /* sil_3131/sil_3531 */ | ||
337 | { | ||
338 | .sht = &sil24_sht, | ||
339 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | ||
340 | ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | | ||
341 | ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(1), | ||
342 | .pio_mask = 0x1f, /* pio0-4 */ | ||
343 | .mwdma_mask = 0x07, /* mwdma0-2 */ | ||
344 | .udma_mask = 0x3f, /* udma0-5 */ | ||
345 | .port_ops = &sil24_ops, | ||
346 | }, | ||
347 | }; | ||
348 | |||
349 | static inline void sil24_update_tf(struct ata_port *ap) | ||
350 | { | ||
351 | struct sil24_port_priv *pp = ap->private_data; | ||
352 | void *port = (void *)ap->ioaddr.cmd_addr; | ||
353 | struct sil24_prb *prb = port; | ||
354 | |||
355 | ata_tf_from_fis(prb->fis, &pp->tf); | ||
356 | } | ||
357 | |||
358 | static u8 sil24_check_status(struct ata_port *ap) | ||
359 | { | ||
360 | struct sil24_port_priv *pp = ap->private_data; | ||
361 | return pp->tf.command; | ||
362 | } | ||
363 | |||
364 | static u8 sil24_check_err(struct ata_port *ap) | ||
365 | { | ||
366 | struct sil24_port_priv *pp = ap->private_data; | ||
367 | return pp->tf.feature; | ||
368 | } | ||
369 | |||
370 | static int sil24_scr_map[] = { | ||
371 | [SCR_CONTROL] = 0, | ||
372 | [SCR_STATUS] = 1, | ||
373 | [SCR_ERROR] = 2, | ||
374 | [SCR_ACTIVE] = 3, | ||
375 | }; | ||
376 | |||
377 | static u32 sil24_scr_read(struct ata_port *ap, unsigned sc_reg) | ||
378 | { | ||
379 | void *scr_addr = (void *)ap->ioaddr.scr_addr; | ||
380 | if (sc_reg < ARRAY_SIZE(sil24_scr_map)) { | ||
381 | void *addr; | ||
382 | addr = scr_addr + sil24_scr_map[sc_reg] * 4; | ||
383 | return readl(scr_addr + sil24_scr_map[sc_reg] * 4); | ||
384 | } | ||
385 | return 0xffffffffU; | ||
386 | } | ||
387 | |||
388 | static void sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val) | ||
389 | { | ||
390 | void *scr_addr = (void *)ap->ioaddr.scr_addr; | ||
391 | if (sc_reg < ARRAY_SIZE(sil24_scr_map)) { | ||
392 | void *addr; | ||
393 | addr = scr_addr + sil24_scr_map[sc_reg] * 4; | ||
394 | writel(val, scr_addr + sil24_scr_map[sc_reg] * 4); | ||
395 | } | ||
396 | } | ||
397 | |||
398 | static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf) | ||
399 | { | ||
400 | struct sil24_port_priv *pp = ap->private_data; | ||
401 | *tf = pp->tf; | ||
402 | } | ||
403 | |||
404 | static void sil24_phy_reset(struct ata_port *ap) | ||
405 | { | ||
406 | __sata_phy_reset(ap); | ||
407 | /* | ||
408 | * No ATAPI yet. Just unconditionally indicate ATA device. | ||
409 | * If ATAPI device is attached, it will fail ATA_CMD_ID_ATA | ||
410 | * and libata core will ignore the device. | ||
411 | */ | ||
412 | if (!(ap->flags & ATA_FLAG_PORT_DISABLED)) | ||
413 | ap->device[0].class = ATA_DEV_ATA; | ||
414 | } | ||
415 | |||
416 | static inline void sil24_fill_sg(struct ata_queued_cmd *qc, | ||
417 | struct sil24_cmd_block *cb) | ||
418 | { | ||
419 | struct scatterlist *sg = qc->sg; | ||
420 | struct sil24_sge *sge = cb->sge; | ||
421 | unsigned i; | ||
422 | |||
423 | for (i = 0; i < qc->n_elem; i++, sg++, sge++) { | ||
424 | sge->addr = cpu_to_le64(sg_dma_address(sg)); | ||
425 | sge->cnt = cpu_to_le32(sg_dma_len(sg)); | ||
426 | sge->flags = 0; | ||
427 | sge->flags = i < qc->n_elem - 1 ? 0 : cpu_to_le32(SGE_TRM); | ||
428 | } | ||
429 | } | ||
430 | |||
431 | static void sil24_qc_prep(struct ata_queued_cmd *qc) | ||
432 | { | ||
433 | struct ata_port *ap = qc->ap; | ||
434 | struct sil24_port_priv *pp = ap->private_data; | ||
435 | struct sil24_cmd_block *cb = pp->cmd_block + qc->tag; | ||
436 | struct sil24_prb *prb = &cb->prb; | ||
437 | |||
438 | switch (qc->tf.protocol) { | ||
439 | case ATA_PROT_PIO: | ||
440 | case ATA_PROT_DMA: | ||
441 | case ATA_PROT_NODATA: | ||
442 | break; | ||
443 | default: | ||
444 | /* ATAPI isn't supported yet */ | ||
445 | BUG(); | ||
446 | } | ||
447 | |||
448 | ata_tf_to_fis(&qc->tf, prb->fis, 0); | ||
449 | |||
450 | if (qc->flags & ATA_QCFLAG_DMAMAP) | ||
451 | sil24_fill_sg(qc, cb); | ||
452 | } | ||
453 | |||
454 | static int sil24_qc_issue(struct ata_queued_cmd *qc) | ||
455 | { | ||
456 | struct ata_port *ap = qc->ap; | ||
457 | void *port = (void *)ap->ioaddr.cmd_addr; | ||
458 | struct sil24_port_priv *pp = ap->private_data; | ||
459 | dma_addr_t paddr = pp->cmd_block_dma + qc->tag * sizeof(*pp->cmd_block); | ||
460 | |||
461 | writel((u32)paddr, port + PORT_CMD_ACTIVATE); | ||
462 | return 0; | ||
463 | } | ||
464 | |||
465 | static void sil24_irq_clear(struct ata_port *ap) | ||
466 | { | ||
467 | /* unused */ | ||
468 | } | ||
469 | |||
470 | static int __sil24_reset_controller(void *port) | ||
471 | { | ||
472 | int cnt; | ||
473 | u32 tmp; | ||
474 | |||
475 | /* Reset controller state. Is this correct? */ | ||
476 | writel(PORT_CS_DEV_RST, port + PORT_CTRL_STAT); | ||
477 | readl(port + PORT_CTRL_STAT); /* sync */ | ||
478 | |||
479 | /* Max ~100ms */ | ||
480 | for (cnt = 0; cnt < 1000; cnt++) { | ||
481 | udelay(100); | ||
482 | tmp = readl(port + PORT_CTRL_STAT); | ||
483 | if (!(tmp & PORT_CS_DEV_RST)) | ||
484 | break; | ||
485 | } | ||
486 | |||
487 | if (tmp & PORT_CS_DEV_RST) | ||
488 | return -1; | ||
489 | return 0; | ||
490 | } | ||
491 | |||
492 | static void sil24_reset_controller(struct ata_port *ap) | ||
493 | { | ||
494 | printk(KERN_NOTICE DRV_NAME | ||
495 | " ata%u: resetting controller...\n", ap->id); | ||
496 | if (__sil24_reset_controller((void *)ap->ioaddr.cmd_addr)) | ||
497 | printk(KERN_ERR DRV_NAME | ||
498 | " ata%u: failed to reset controller\n", ap->id); | ||
499 | } | ||
500 | |||
501 | static void sil24_eng_timeout(struct ata_port *ap) | ||
502 | { | ||
503 | struct ata_queued_cmd *qc; | ||
504 | |||
505 | qc = ata_qc_from_tag(ap, ap->active_tag); | ||
506 | if (!qc) { | ||
507 | printk(KERN_ERR "ata%u: BUG: tiemout without command\n", | ||
508 | ap->id); | ||
509 | return; | ||
510 | } | ||
511 | |||
512 | /* | ||
513 | * hack alert! We cannot use the supplied completion | ||
514 | * function from inside the ->eh_strategy_handler() thread. | ||
515 | * libata is the only user of ->eh_strategy_handler() in | ||
516 | * any kernel, so the default scsi_done() assumes it is | ||
517 | * not being called from the SCSI EH. | ||
518 | */ | ||
519 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); | ||
520 | qc->scsidone = scsi_finish_command; | ||
521 | ata_qc_complete(qc, ATA_ERR); | ||
522 | |||
523 | sil24_reset_controller(ap); | ||
524 | } | ||
525 | |||
526 | static void sil24_error_intr(struct ata_port *ap, u32 slot_stat) | ||
527 | { | ||
528 | struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->active_tag); | ||
529 | struct sil24_port_priv *pp = ap->private_data; | ||
530 | void *port = (void *)ap->ioaddr.cmd_addr; | ||
531 | u32 irq_stat, cmd_err, sstatus, serror; | ||
532 | |||
533 | irq_stat = readl(port + PORT_IRQ_STAT); | ||
534 | writel(irq_stat, port + PORT_IRQ_STAT); /* clear irq */ | ||
535 | |||
536 | if (!(irq_stat & PORT_IRQ_ERROR)) { | ||
537 | /* ignore non-completion, non-error irqs for now */ | ||
538 | printk(KERN_WARNING DRV_NAME | ||
539 | "ata%u: non-error exception irq (irq_stat %x)\n", | ||
540 | ap->id, irq_stat); | ||
541 | return; | ||
542 | } | ||
543 | |||
544 | cmd_err = readl(port + PORT_CMD_ERR); | ||
545 | sstatus = readl(port + PORT_SSTATUS); | ||
546 | serror = readl(port + PORT_SERROR); | ||
547 | if (serror) | ||
548 | writel(serror, port + PORT_SERROR); | ||
549 | |||
550 | printk(KERN_ERR DRV_NAME " ata%u: error interrupt on port%d\n" | ||
551 | " stat=0x%x irq=0x%x cmd_err=%d sstatus=0x%x serror=0x%x\n", | ||
552 | ap->id, ap->port_no, slot_stat, irq_stat, cmd_err, sstatus, serror); | ||
553 | |||
554 | if (cmd_err == PORT_CERR_DEV || cmd_err == PORT_CERR_SDB) { | ||
555 | /* | ||
556 | * Device is reporting error, tf registers are valid. | ||
557 | */ | ||
558 | sil24_update_tf(ap); | ||
559 | } else { | ||
560 | /* | ||
561 | * Other errors. libata currently doesn't have any | ||
562 | * mechanism to report these errors. Just turn on | ||
563 | * ATA_ERR. | ||
564 | */ | ||
565 | pp->tf.command = ATA_ERR; | ||
566 | } | ||
567 | |||
568 | if (qc) | ||
569 | ata_qc_complete(qc, pp->tf.command); | ||
570 | |||
571 | sil24_reset_controller(ap); | ||
572 | } | ||
573 | |||
574 | static inline void sil24_host_intr(struct ata_port *ap) | ||
575 | { | ||
576 | struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->active_tag); | ||
577 | void *port = (void *)ap->ioaddr.cmd_addr; | ||
578 | u32 slot_stat; | ||
579 | |||
580 | slot_stat = readl(port + PORT_SLOT_STAT); | ||
581 | if (!(slot_stat & HOST_SSTAT_ATTN)) { | ||
582 | struct sil24_port_priv *pp = ap->private_data; | ||
583 | /* | ||
584 | * !HOST_SSAT_ATTN guarantees successful completion, | ||
585 | * so reading back tf registers is unnecessary for | ||
586 | * most commands. TODO: read tf registers for | ||
587 | * commands which require these values on successful | ||
588 | * completion (EXECUTE DEVICE DIAGNOSTIC, CHECK POWER, | ||
589 | * DEVICE RESET and READ PORT MULTIPLIER (any more?). | ||
590 | */ | ||
591 | sil24_update_tf(ap); | ||
592 | |||
593 | if (qc) | ||
594 | ata_qc_complete(qc, pp->tf.command); | ||
595 | } else | ||
596 | sil24_error_intr(ap, slot_stat); | ||
597 | } | ||
598 | |||
599 | static irqreturn_t sil24_interrupt(int irq, void *dev_instance, struct pt_regs *regs) | ||
600 | { | ||
601 | struct ata_host_set *host_set = dev_instance; | ||
602 | struct sil24_host_priv *hpriv = host_set->private_data; | ||
603 | unsigned handled = 0; | ||
604 | u32 status; | ||
605 | int i; | ||
606 | |||
607 | status = readl(hpriv->host_base + HOST_IRQ_STAT); | ||
608 | |||
609 | if (status == 0xffffffff) { | ||
610 | printk(KERN_ERR DRV_NAME ": IRQ status == 0xffffffff, " | ||
611 | "PCI fault or device removal?\n"); | ||
612 | goto out; | ||
613 | } | ||
614 | |||
615 | if (!(status & IRQ_STAT_4PORTS)) | ||
616 | goto out; | ||
617 | |||
618 | spin_lock(&host_set->lock); | ||
619 | |||
620 | for (i = 0; i < host_set->n_ports; i++) | ||
621 | if (status & (1 << i)) { | ||
622 | struct ata_port *ap = host_set->ports[i]; | ||
623 | if (ap && !(ap->flags & ATA_FLAG_PORT_DISABLED)) { | ||
624 | sil24_host_intr(host_set->ports[i]); | ||
625 | handled++; | ||
626 | } else | ||
627 | printk(KERN_ERR DRV_NAME | ||
628 | ": interrupt from disabled port %d\n", i); | ||
629 | } | ||
630 | |||
631 | spin_unlock(&host_set->lock); | ||
632 | out: | ||
633 | return IRQ_RETVAL(handled); | ||
634 | } | ||
635 | |||
636 | static int sil24_port_start(struct ata_port *ap) | ||
637 | { | ||
638 | struct device *dev = ap->host_set->dev; | ||
639 | struct sil24_port_priv *pp; | ||
640 | struct sil24_cmd_block *cb; | ||
641 | size_t cb_size = sizeof(*cb); | ||
642 | dma_addr_t cb_dma; | ||
643 | |||
644 | pp = kmalloc(sizeof(*pp), GFP_KERNEL); | ||
645 | if (!pp) | ||
646 | return -ENOMEM; | ||
647 | memset(pp, 0, sizeof(*pp)); | ||
648 | |||
649 | pp->tf.command = ATA_DRDY; | ||
650 | |||
651 | cb = dma_alloc_coherent(dev, cb_size, &cb_dma, GFP_KERNEL); | ||
652 | if (!cb) { | ||
653 | kfree(pp); | ||
654 | return -ENOMEM; | ||
655 | } | ||
656 | memset(cb, 0, cb_size); | ||
657 | |||
658 | pp->cmd_block = cb; | ||
659 | pp->cmd_block_dma = cb_dma; | ||
660 | |||
661 | ap->private_data = pp; | ||
662 | |||
663 | return 0; | ||
664 | } | ||
665 | |||
666 | static void sil24_port_stop(struct ata_port *ap) | ||
667 | { | ||
668 | struct device *dev = ap->host_set->dev; | ||
669 | struct sil24_port_priv *pp = ap->private_data; | ||
670 | size_t cb_size = sizeof(*pp->cmd_block); | ||
671 | |||
672 | dma_free_coherent(dev, cb_size, pp->cmd_block, pp->cmd_block_dma); | ||
673 | kfree(pp); | ||
674 | } | ||
675 | |||
676 | static void sil24_host_stop(struct ata_host_set *host_set) | ||
677 | { | ||
678 | struct sil24_host_priv *hpriv = host_set->private_data; | ||
679 | |||
680 | iounmap(hpriv->host_base); | ||
681 | iounmap(hpriv->port_base); | ||
682 | kfree(hpriv); | ||
683 | } | ||
684 | |||
685 | static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | ||
686 | { | ||
687 | static int printed_version = 0; | ||
688 | unsigned int board_id = (unsigned int)ent->driver_data; | ||
689 | struct ata_port_info *pinfo = &sil24_port_info[board_id]; | ||
690 | struct ata_probe_ent *probe_ent = NULL; | ||
691 | struct sil24_host_priv *hpriv = NULL; | ||
692 | void *host_base = NULL, *port_base = NULL; | ||
693 | int i, rc; | ||
694 | |||
695 | if (!printed_version++) | ||
696 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); | ||
697 | |||
698 | rc = pci_enable_device(pdev); | ||
699 | if (rc) | ||
700 | return rc; | ||
701 | |||
702 | rc = pci_request_regions(pdev, DRV_NAME); | ||
703 | if (rc) | ||
704 | goto out_disable; | ||
705 | |||
706 | rc = -ENOMEM; | ||
707 | /* ioremap mmio registers */ | ||
708 | host_base = ioremap(pci_resource_start(pdev, 0), | ||
709 | pci_resource_len(pdev, 0)); | ||
710 | if (!host_base) | ||
711 | goto out_free; | ||
712 | port_base = ioremap(pci_resource_start(pdev, 2), | ||
713 | pci_resource_len(pdev, 2)); | ||
714 | if (!port_base) | ||
715 | goto out_free; | ||
716 | |||
717 | /* allocate & init probe_ent and hpriv */ | ||
718 | probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL); | ||
719 | if (!probe_ent) | ||
720 | goto out_free; | ||
721 | |||
722 | hpriv = kmalloc(sizeof(*hpriv), GFP_KERNEL); | ||
723 | if (!hpriv) | ||
724 | goto out_free; | ||
725 | |||
726 | memset(probe_ent, 0, sizeof(*probe_ent)); | ||
727 | probe_ent->dev = pci_dev_to_dev(pdev); | ||
728 | INIT_LIST_HEAD(&probe_ent->node); | ||
729 | |||
730 | probe_ent->sht = pinfo->sht; | ||
731 | probe_ent->host_flags = pinfo->host_flags; | ||
732 | probe_ent->pio_mask = pinfo->pio_mask; | ||
733 | probe_ent->udma_mask = pinfo->udma_mask; | ||
734 | probe_ent->port_ops = pinfo->port_ops; | ||
735 | probe_ent->n_ports = SIL24_FLAG2NPORTS(pinfo->host_flags); | ||
736 | |||
737 | probe_ent->irq = pdev->irq; | ||
738 | probe_ent->irq_flags = SA_SHIRQ; | ||
739 | probe_ent->mmio_base = port_base; | ||
740 | probe_ent->private_data = hpriv; | ||
741 | |||
742 | memset(hpriv, 0, sizeof(*hpriv)); | ||
743 | hpriv->host_base = host_base; | ||
744 | hpriv->port_base = port_base; | ||
745 | |||
746 | /* | ||
747 | * Configure the device | ||
748 | */ | ||
749 | /* | ||
750 | * FIXME: This device is certainly 64-bit capable. We just | ||
751 | * don't know how to use it. After fixing 32bit activation in | ||
752 | * this function, enable 64bit masks here. | ||
753 | */ | ||
754 | rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); | ||
755 | if (rc) { | ||
756 | printk(KERN_ERR DRV_NAME "(%s): 32-bit DMA enable failed\n", | ||
757 | pci_name(pdev)); | ||
758 | goto out_free; | ||
759 | } | ||
760 | rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); | ||
761 | if (rc) { | ||
762 | printk(KERN_ERR DRV_NAME "(%s): 32-bit consistent DMA enable failed\n", | ||
763 | pci_name(pdev)); | ||
764 | goto out_free; | ||
765 | } | ||
766 | |||
767 | /* GPIO off */ | ||
768 | writel(0, host_base + HOST_FLASH_CMD); | ||
769 | |||
770 | /* Mask interrupts during initialization */ | ||
771 | writel(0, host_base + HOST_CTRL); | ||
772 | |||
773 | for (i = 0; i < probe_ent->n_ports; i++) { | ||
774 | void *port = port_base + i * PORT_REGS_SIZE; | ||
775 | unsigned long portu = (unsigned long)port; | ||
776 | u32 tmp; | ||
777 | int cnt; | ||
778 | |||
779 | probe_ent->port[i].cmd_addr = portu + PORT_PRB; | ||
780 | probe_ent->port[i].scr_addr = portu + PORT_SCONTROL; | ||
781 | |||
782 | ata_std_ports(&probe_ent->port[i]); | ||
783 | |||
784 | /* Initial PHY setting */ | ||
785 | writel(0x20c, port + PORT_PHY_CFG); | ||
786 | |||
787 | /* Clear port RST */ | ||
788 | tmp = readl(port + PORT_CTRL_STAT); | ||
789 | if (tmp & PORT_CS_PORT_RST) { | ||
790 | writel(PORT_CS_PORT_RST, port + PORT_CTRL_CLR); | ||
791 | readl(port + PORT_CTRL_STAT); /* sync */ | ||
792 | for (cnt = 0; cnt < 10; cnt++) { | ||
793 | msleep(10); | ||
794 | tmp = readl(port + PORT_CTRL_STAT); | ||
795 | if (!(tmp & PORT_CS_PORT_RST)) | ||
796 | break; | ||
797 | } | ||
798 | if (tmp & PORT_CS_PORT_RST) | ||
799 | printk(KERN_ERR DRV_NAME | ||
800 | "(%s): failed to clear port RST\n", | ||
801 | pci_name(pdev)); | ||
802 | } | ||
803 | |||
804 | /* Zero error counters. */ | ||
805 | writel(0x8000, port + PORT_DECODE_ERR_THRESH); | ||
806 | writel(0x8000, port + PORT_CRC_ERR_THRESH); | ||
807 | writel(0x8000, port + PORT_HSHK_ERR_THRESH); | ||
808 | writel(0x0000, port + PORT_DECODE_ERR_CNT); | ||
809 | writel(0x0000, port + PORT_CRC_ERR_CNT); | ||
810 | writel(0x0000, port + PORT_HSHK_ERR_CNT); | ||
811 | |||
812 | /* FIXME: 32bit activation? */ | ||
813 | writel(0, port + PORT_ACTIVATE_UPPER_ADDR); | ||
814 | writel(PORT_CS_32BIT_ACTV, port + PORT_CTRL_STAT); | ||
815 | |||
816 | /* Configure interrupts */ | ||
817 | writel(0xffff, port + PORT_IRQ_ENABLE_CLR); | ||
818 | writel(PORT_IRQ_COMPLETE | PORT_IRQ_ERROR | PORT_IRQ_SDB_FIS, | ||
819 | port + PORT_IRQ_ENABLE_SET); | ||
820 | |||
821 | /* Clear interrupts */ | ||
822 | writel(0x0fff0fff, port + PORT_IRQ_STAT); | ||
823 | writel(PORT_CS_IRQ_WOC, port + PORT_CTRL_CLR); | ||
824 | |||
825 | /* Clear port multiplier enable and resume bits */ | ||
826 | writel(PORT_CS_PM_EN | PORT_CS_RESUME, port + PORT_CTRL_CLR); | ||
827 | |||
828 | /* Reset itself */ | ||
829 | if (__sil24_reset_controller(port)) | ||
830 | printk(KERN_ERR DRV_NAME | ||
831 | "(%s): failed to reset controller\n", | ||
832 | pci_name(pdev)); | ||
833 | } | ||
834 | |||
835 | /* Turn on interrupts */ | ||
836 | writel(IRQ_STAT_4PORTS, host_base + HOST_CTRL); | ||
837 | |||
838 | pci_set_master(pdev); | ||
839 | |||
840 | /* FIXME: check ata_device_add return value */ | ||
841 | ata_device_add(probe_ent); | ||
842 | |||
843 | kfree(probe_ent); | ||
844 | return 0; | ||
845 | |||
846 | out_free: | ||
847 | if (host_base) | ||
848 | iounmap(host_base); | ||
849 | if (port_base) | ||
850 | iounmap(port_base); | ||
851 | kfree(probe_ent); | ||
852 | kfree(hpriv); | ||
853 | pci_release_regions(pdev); | ||
854 | out_disable: | ||
855 | pci_disable_device(pdev); | ||
856 | return rc; | ||
857 | } | ||
858 | |||
859 | static int __init sil24_init(void) | ||
860 | { | ||
861 | return pci_module_init(&sil24_pci_driver); | ||
862 | } | ||
863 | |||
864 | static void __exit sil24_exit(void) | ||
865 | { | ||
866 | pci_unregister_driver(&sil24_pci_driver); | ||
867 | } | ||
868 | |||
869 | MODULE_AUTHOR("Tejun Heo"); | ||
870 | MODULE_DESCRIPTION("Silicon Image 3124/3132 SATA low-level driver"); | ||
871 | MODULE_LICENSE("GPL"); | ||
872 | MODULE_DEVICE_TABLE(pci, sil24_pci_tbl); | ||
873 | |||
874 | module_init(sil24_init); | ||
875 | module_exit(sil24_exit); | ||
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c index 6b321e82cafb..c2786fc41cc5 100644 --- a/drivers/serial/8250_pnp.c +++ b/drivers/serial/8250_pnp.c | |||
@@ -272,6 +272,8 @@ static const struct pnp_device_id pnp_dev_table[] = { | |||
272 | { "SUP1421", 0 }, | 272 | { "SUP1421", 0 }, |
273 | /* SupraExpress 33.6 Data/Fax PnP modem */ | 273 | /* SupraExpress 33.6 Data/Fax PnP modem */ |
274 | { "SUP1590", 0 }, | 274 | { "SUP1590", 0 }, |
275 | /* SupraExpress 336i Sp ASVD */ | ||
276 | { "SUP1620", 0 }, | ||
275 | /* SupraExpress 33.6 Data/Fax PnP modem */ | 277 | /* SupraExpress 33.6 Data/Fax PnP modem */ |
276 | { "SUP1760", 0 }, | 278 | { "SUP1760", 0 }, |
277 | /* Phoebe Micro */ | 279 | /* Phoebe Micro */ |
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index 4e1e80adaf11..bdb4e454b8b0 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c | |||
@@ -73,7 +73,7 @@ struct imx_port { | |||
73 | struct uart_port port; | 73 | struct uart_port port; |
74 | struct timer_list timer; | 74 | struct timer_list timer; |
75 | unsigned int old_status; | 75 | unsigned int old_status; |
76 | int txirq,rxirq; | 76 | int txirq,rxirq,rtsirq; |
77 | }; | 77 | }; |
78 | 78 | ||
79 | /* | 79 | /* |
@@ -181,6 +181,22 @@ static void imx_start_tx(struct uart_port *port) | |||
181 | imx_transmit_buffer(sport); | 181 | imx_transmit_buffer(sport); |
182 | } | 182 | } |
183 | 183 | ||
184 | static irqreturn_t imx_rtsint(int irq, void *dev_id, struct pt_regs *regs) | ||
185 | { | ||
186 | struct imx_port *sport = (struct imx_port *)dev_id; | ||
187 | unsigned int val = USR1((u32)sport->port.membase)&USR1_RTSS; | ||
188 | unsigned long flags; | ||
189 | |||
190 | spin_lock_irqsave(&sport->port.lock, flags); | ||
191 | |||
192 | USR1((u32)sport->port.membase) = USR1_RTSD; | ||
193 | uart_handle_cts_change(&sport->port, !!val); | ||
194 | wake_up_interruptible(&sport->port.info->delta_msr_wait); | ||
195 | |||
196 | spin_unlock_irqrestore(&sport->port.lock, flags); | ||
197 | return IRQ_HANDLED; | ||
198 | } | ||
199 | |||
184 | static irqreturn_t imx_txint(int irq, void *dev_id, struct pt_regs *regs) | 200 | static irqreturn_t imx_txint(int irq, void *dev_id, struct pt_regs *regs) |
185 | { | 201 | { |
186 | struct imx_port *sport = (struct imx_port *)dev_id; | 202 | struct imx_port *sport = (struct imx_port *)dev_id; |
@@ -383,18 +399,24 @@ static int imx_startup(struct uart_port *port) | |||
383 | */ | 399 | */ |
384 | retval = request_irq(sport->rxirq, imx_rxint, 0, | 400 | retval = request_irq(sport->rxirq, imx_rxint, 0, |
385 | DRIVER_NAME, sport); | 401 | DRIVER_NAME, sport); |
386 | if (retval) goto error_out2; | 402 | if (retval) goto error_out1; |
387 | 403 | ||
388 | retval = request_irq(sport->txirq, imx_txint, 0, | 404 | retval = request_irq(sport->txirq, imx_txint, 0, |
389 | "imx-uart", sport); | 405 | DRIVER_NAME, sport); |
390 | if (retval) goto error_out1; | 406 | if (retval) goto error_out2; |
407 | |||
408 | retval = request_irq(sport->rtsirq, imx_rtsint, 0, | ||
409 | DRIVER_NAME, sport); | ||
410 | if (retval) goto error_out3; | ||
411 | set_irq_type(sport->rtsirq, IRQT_BOTHEDGE); | ||
391 | 412 | ||
392 | /* | 413 | /* |
393 | * Finally, clear and enable interrupts | 414 | * Finally, clear and enable interrupts |
394 | */ | 415 | */ |
395 | 416 | ||
417 | USR1((u32)sport->port.membase) = USR1_RTSD; | ||
396 | UCR1((u32)sport->port.membase) |= | 418 | UCR1((u32)sport->port.membase) |= |
397 | (UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_UARTEN); | 419 | (UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN); |
398 | 420 | ||
399 | UCR2((u32)sport->port.membase) |= (UCR2_RXEN | UCR2_TXEN); | 421 | UCR2((u32)sport->port.membase) |= (UCR2_RXEN | UCR2_TXEN); |
400 | /* | 422 | /* |
@@ -406,10 +428,11 @@ static int imx_startup(struct uart_port *port) | |||
406 | 428 | ||
407 | return 0; | 429 | return 0; |
408 | 430 | ||
409 | error_out1: | 431 | error_out3: |
410 | free_irq(sport->rxirq, sport); | ||
411 | error_out2: | ||
412 | free_irq(sport->txirq, sport); | 432 | free_irq(sport->txirq, sport); |
433 | error_out2: | ||
434 | free_irq(sport->rxirq, sport); | ||
435 | error_out1: | ||
413 | return retval; | 436 | return retval; |
414 | } | 437 | } |
415 | 438 | ||
@@ -425,6 +448,7 @@ static void imx_shutdown(struct uart_port *port) | |||
425 | /* | 448 | /* |
426 | * Free the interrupts | 449 | * Free the interrupts |
427 | */ | 450 | */ |
451 | free_irq(sport->rtsirq, sport); | ||
428 | free_irq(sport->txirq, sport); | 452 | free_irq(sport->txirq, sport); |
429 | free_irq(sport->rxirq, sport); | 453 | free_irq(sport->rxirq, sport); |
430 | 454 | ||
@@ -433,7 +457,7 @@ static void imx_shutdown(struct uart_port *port) | |||
433 | */ | 457 | */ |
434 | 458 | ||
435 | UCR1((u32)sport->port.membase) &= | 459 | UCR1((u32)sport->port.membase) &= |
436 | ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_UARTEN); | 460 | ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN); |
437 | } | 461 | } |
438 | 462 | ||
439 | static void | 463 | static void |
@@ -523,7 +547,7 @@ imx_set_termios(struct uart_port *port, struct termios *termios, | |||
523 | * disable interrupts and drain transmitter | 547 | * disable interrupts and drain transmitter |
524 | */ | 548 | */ |
525 | old_ucr1 = UCR1((u32)sport->port.membase); | 549 | old_ucr1 = UCR1((u32)sport->port.membase); |
526 | UCR1((u32)sport->port.membase) &= ~(UCR1_TXMPTYEN | UCR1_RRDYEN); | 550 | UCR1((u32)sport->port.membase) &= ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN); |
527 | 551 | ||
528 | while ( !(USR2((u32)sport->port.membase) & USR2_TXDC)) | 552 | while ( !(USR2((u32)sport->port.membase) & USR2_TXDC)) |
529 | barrier(); | 553 | barrier(); |
@@ -644,6 +668,7 @@ static struct imx_port imx_ports[] = { | |||
644 | { | 668 | { |
645 | .txirq = UART1_MINT_TX, | 669 | .txirq = UART1_MINT_TX, |
646 | .rxirq = UART1_MINT_RX, | 670 | .rxirq = UART1_MINT_RX, |
671 | .rtsirq = UART1_MINT_RTS, | ||
647 | .port = { | 672 | .port = { |
648 | .type = PORT_IMX, | 673 | .type = PORT_IMX, |
649 | .iotype = SERIAL_IO_MEM, | 674 | .iotype = SERIAL_IO_MEM, |
@@ -659,6 +684,7 @@ static struct imx_port imx_ports[] = { | |||
659 | }, { | 684 | }, { |
660 | .txirq = UART2_MINT_TX, | 685 | .txirq = UART2_MINT_TX, |
661 | .rxirq = UART2_MINT_RX, | 686 | .rxirq = UART2_MINT_RX, |
687 | .rtsirq = UART2_MINT_RTS, | ||
662 | .port = { | 688 | .port = { |
663 | .type = PORT_IMX, | 689 | .type = PORT_IMX, |
664 | .iotype = SERIAL_IO_MEM, | 690 | .iotype = SERIAL_IO_MEM, |
@@ -738,7 +764,7 @@ imx_console_write(struct console *co, const char *s, unsigned int count) | |||
738 | 764 | ||
739 | UCR1((u32)sport->port.membase) = | 765 | UCR1((u32)sport->port.membase) = |
740 | (old_ucr1 | UCR1_UARTCLKEN | UCR1_UARTEN) | 766 | (old_ucr1 | UCR1_UARTCLKEN | UCR1_UARTEN) |
741 | & ~(UCR1_TXMPTYEN | UCR1_RRDYEN); | 767 | & ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN); |
742 | UCR2((u32)sport->port.membase) = old_ucr2 | UCR2_TXEN; | 768 | UCR2((u32)sport->port.membase) = old_ucr2 | UCR2_TXEN; |
743 | 769 | ||
744 | /* | 770 | /* |
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c index 672b359b07ce..90c2a86c421b 100644 --- a/drivers/serial/pxa.c +++ b/drivers/serial/pxa.c | |||
@@ -499,7 +499,7 @@ serial_pxa_set_termios(struct uart_port *port, struct termios *termios, | |||
499 | /* | 499 | /* |
500 | * Update the per-port timeout. | 500 | * Update the per-port timeout. |
501 | */ | 501 | */ |
502 | uart_update_timeout(port, termios->c_cflag, quot); | 502 | uart_update_timeout(port, termios->c_cflag, baud); |
503 | 503 | ||
504 | up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; | 504 | up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; |
505 | if (termios->c_iflag & INPCK) | 505 | if (termios->c_iflag & INPCK) |
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c index 50d7870d92bb..52692aa345ec 100644 --- a/drivers/serial/s3c2410.c +++ b/drivers/serial/s3c2410.c | |||
@@ -1092,8 +1092,8 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, | |||
1092 | 1092 | ||
1093 | static int probe_index = 0; | 1093 | static int probe_index = 0; |
1094 | 1094 | ||
1095 | int s3c24xx_serial_probe(struct device *_dev, | 1095 | static int s3c24xx_serial_probe(struct device *_dev, |
1096 | struct s3c24xx_uart_info *info) | 1096 | struct s3c24xx_uart_info *info) |
1097 | { | 1097 | { |
1098 | struct s3c24xx_uart_port *ourport; | 1098 | struct s3c24xx_uart_port *ourport; |
1099 | struct platform_device *dev = to_platform_device(_dev); | 1099 | struct platform_device *dev = to_platform_device(_dev); |
@@ -1120,7 +1120,7 @@ int s3c24xx_serial_probe(struct device *_dev, | |||
1120 | return ret; | 1120 | return ret; |
1121 | } | 1121 | } |
1122 | 1122 | ||
1123 | int s3c24xx_serial_remove(struct device *_dev) | 1123 | static int s3c24xx_serial_remove(struct device *_dev) |
1124 | { | 1124 | { |
1125 | struct uart_port *port = s3c24xx_dev_to_port(_dev); | 1125 | struct uart_port *port = s3c24xx_dev_to_port(_dev); |
1126 | 1126 | ||
@@ -1134,7 +1134,8 @@ int s3c24xx_serial_remove(struct device *_dev) | |||
1134 | 1134 | ||
1135 | #ifdef CONFIG_PM | 1135 | #ifdef CONFIG_PM |
1136 | 1136 | ||
1137 | int s3c24xx_serial_suspend(struct device *dev, pm_message_t state, u32 level) | 1137 | static int s3c24xx_serial_suspend(struct device *dev, pm_message_t state, |
1138 | u32 level) | ||
1138 | { | 1139 | { |
1139 | struct uart_port *port = s3c24xx_dev_to_port(dev); | 1140 | struct uart_port *port = s3c24xx_dev_to_port(dev); |
1140 | 1141 | ||
@@ -1144,7 +1145,7 @@ int s3c24xx_serial_suspend(struct device *dev, pm_message_t state, u32 level) | |||
1144 | return 0; | 1145 | return 0; |
1145 | } | 1146 | } |
1146 | 1147 | ||
1147 | int s3c24xx_serial_resume(struct device *dev, u32 level) | 1148 | static int s3c24xx_serial_resume(struct device *dev, u32 level) |
1148 | { | 1149 | { |
1149 | struct uart_port *port = s3c24xx_dev_to_port(dev); | 1150 | struct uart_port *port = s3c24xx_dev_to_port(dev); |
1150 | struct s3c24xx_uart_port *ourport = to_ourport(port); | 1151 | struct s3c24xx_uart_port *ourport = to_ourport(port); |
@@ -1165,8 +1166,8 @@ int s3c24xx_serial_resume(struct device *dev, u32 level) | |||
1165 | #define s3c24xx_serial_resume NULL | 1166 | #define s3c24xx_serial_resume NULL |
1166 | #endif | 1167 | #endif |
1167 | 1168 | ||
1168 | int s3c24xx_serial_init(struct device_driver *drv, | 1169 | static int s3c24xx_serial_init(struct device_driver *drv, |
1169 | struct s3c24xx_uart_info *info) | 1170 | struct s3c24xx_uart_info *info) |
1170 | { | 1171 | { |
1171 | dbg("s3c24xx_serial_init(%p,%p)\n", drv, info); | 1172 | dbg("s3c24xx_serial_init(%p,%p)\n", drv, info); |
1172 | return driver_register(drv); | 1173 | return driver_register(drv); |
@@ -1235,6 +1236,7 @@ static int s3c2400_serial_probe(struct device *dev) | |||
1235 | 1236 | ||
1236 | static struct device_driver s3c2400_serial_drv = { | 1237 | static struct device_driver s3c2400_serial_drv = { |
1237 | .name = "s3c2400-uart", | 1238 | .name = "s3c2400-uart", |
1239 | .owner = THIS_MODULE, | ||
1238 | .bus = &platform_bus_type, | 1240 | .bus = &platform_bus_type, |
1239 | .probe = s3c2400_serial_probe, | 1241 | .probe = s3c2400_serial_probe, |
1240 | .remove = s3c24xx_serial_remove, | 1242 | .remove = s3c24xx_serial_remove, |
@@ -1338,6 +1340,7 @@ static int s3c2410_serial_probe(struct device *dev) | |||
1338 | 1340 | ||
1339 | static struct device_driver s3c2410_serial_drv = { | 1341 | static struct device_driver s3c2410_serial_drv = { |
1340 | .name = "s3c2410-uart", | 1342 | .name = "s3c2410-uart", |
1343 | .owner = THIS_MODULE, | ||
1341 | .bus = &platform_bus_type, | 1344 | .bus = &platform_bus_type, |
1342 | .probe = s3c2410_serial_probe, | 1345 | .probe = s3c2410_serial_probe, |
1343 | .remove = s3c24xx_serial_remove, | 1346 | .remove = s3c24xx_serial_remove, |
@@ -1499,6 +1502,7 @@ static int s3c2440_serial_probe(struct device *dev) | |||
1499 | 1502 | ||
1500 | static struct device_driver s3c2440_serial_drv = { | 1503 | static struct device_driver s3c2440_serial_drv = { |
1501 | .name = "s3c2440-uart", | 1504 | .name = "s3c2440-uart", |
1505 | .owner = THIS_MODULE, | ||
1502 | .bus = &platform_bus_type, | 1506 | .bus = &platform_bus_type, |
1503 | .probe = s3c2440_serial_probe, | 1507 | .probe = s3c2440_serial_probe, |
1504 | .remove = s3c24xx_serial_remove, | 1508 | .remove = s3c24xx_serial_remove, |
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index 512266307866..430754ebac8a 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c | |||
@@ -967,7 +967,7 @@ static int sci_startup(struct uart_port *port) | |||
967 | #endif | 967 | #endif |
968 | 968 | ||
969 | sci_request_irq(s); | 969 | sci_request_irq(s); |
970 | sci_start_tx(port, 1); | 970 | sci_start_tx(port); |
971 | sci_start_rx(port, 1); | 971 | sci_start_rx(port, 1); |
972 | 972 | ||
973 | return 0; | 973 | return 0; |
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c index e971156daa60..ba9381fd3f2d 100644 --- a/drivers/serial/sunsab.c +++ b/drivers/serial/sunsab.c | |||
@@ -274,7 +274,6 @@ static void transmit_chars(struct uart_sunsab_port *up, | |||
274 | if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { | 274 | if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { |
275 | up->interrupt_mask1 |= SAB82532_IMR1_XPR; | 275 | up->interrupt_mask1 |= SAB82532_IMR1_XPR; |
276 | writeb(up->interrupt_mask1, &up->regs->w.imr1); | 276 | writeb(up->interrupt_mask1, &up->regs->w.imr1); |
277 | uart_write_wakeup(&up->port); | ||
278 | return; | 277 | return; |
279 | } | 278 | } |
280 | 279 | ||
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c index d75445738c88..7653d6cf05af 100644 --- a/drivers/serial/sunzilog.c +++ b/drivers/serial/sunzilog.c | |||
@@ -517,10 +517,9 @@ static void sunzilog_transmit_chars(struct uart_sunzilog_port *up, | |||
517 | if (up->port.info == NULL) | 517 | if (up->port.info == NULL) |
518 | goto ack_tx_int; | 518 | goto ack_tx_int; |
519 | xmit = &up->port.info->xmit; | 519 | xmit = &up->port.info->xmit; |
520 | if (uart_circ_empty(xmit)) { | 520 | if (uart_circ_empty(xmit)) |
521 | uart_write_wakeup(&up->port); | ||
522 | goto ack_tx_int; | 521 | goto ack_tx_int; |
523 | } | 522 | |
524 | if (uart_tx_stopped(&up->port)) | 523 | if (uart_tx_stopped(&up->port)) |
525 | goto ack_tx_int; | 524 | goto ack_tx_int; |
526 | 525 | ||
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index b4265aa7d45e..487ff672b104 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -30,6 +30,8 @@ | |||
30 | * Revision history | 30 | * Revision history |
31 | * 22.12.1999 0.1 Initial release (split from proc_usb.c) | 31 | * 22.12.1999 0.1 Initial release (split from proc_usb.c) |
32 | * 04.01.2000 0.2 Turned into its own filesystem | 32 | * 04.01.2000 0.2 Turned into its own filesystem |
33 | * 30.09.2005 0.3 Fix user-triggerable oops in async URB delivery | ||
34 | * (CAN-2005-3055) | ||
33 | */ | 35 | */ |
34 | 36 | ||
35 | /*****************************************************************************/ | 37 | /*****************************************************************************/ |
@@ -58,7 +60,8 @@ static struct class *usb_device_class; | |||
58 | struct async { | 60 | struct async { |
59 | struct list_head asynclist; | 61 | struct list_head asynclist; |
60 | struct dev_state *ps; | 62 | struct dev_state *ps; |
61 | struct task_struct *task; | 63 | pid_t pid; |
64 | uid_t uid, euid; | ||
62 | unsigned int signr; | 65 | unsigned int signr; |
63 | unsigned int ifnum; | 66 | unsigned int ifnum; |
64 | void __user *userbuffer; | 67 | void __user *userbuffer; |
@@ -290,7 +293,8 @@ static void async_completed(struct urb *urb, struct pt_regs *regs) | |||
290 | sinfo.si_errno = as->urb->status; | 293 | sinfo.si_errno = as->urb->status; |
291 | sinfo.si_code = SI_ASYNCIO; | 294 | sinfo.si_code = SI_ASYNCIO; |
292 | sinfo.si_addr = as->userurb; | 295 | sinfo.si_addr = as->userurb; |
293 | send_sig_info(as->signr, &sinfo, as->task); | 296 | kill_proc_info_as_uid(as->signr, &sinfo, as->pid, as->uid, |
297 | as->euid); | ||
294 | } | 298 | } |
295 | wake_up(&ps->wait); | 299 | wake_up(&ps->wait); |
296 | } | 300 | } |
@@ -526,7 +530,9 @@ static int usbdev_open(struct inode *inode, struct file *file) | |||
526 | INIT_LIST_HEAD(&ps->async_completed); | 530 | INIT_LIST_HEAD(&ps->async_completed); |
527 | init_waitqueue_head(&ps->wait); | 531 | init_waitqueue_head(&ps->wait); |
528 | ps->discsignr = 0; | 532 | ps->discsignr = 0; |
529 | ps->disctask = current; | 533 | ps->disc_pid = current->pid; |
534 | ps->disc_uid = current->uid; | ||
535 | ps->disc_euid = current->euid; | ||
530 | ps->disccontext = NULL; | 536 | ps->disccontext = NULL; |
531 | ps->ifclaimed = 0; | 537 | ps->ifclaimed = 0; |
532 | wmb(); | 538 | wmb(); |
@@ -988,7 +994,9 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
988 | as->userbuffer = NULL; | 994 | as->userbuffer = NULL; |
989 | as->signr = uurb->signr; | 995 | as->signr = uurb->signr; |
990 | as->ifnum = ifnum; | 996 | as->ifnum = ifnum; |
991 | as->task = current; | 997 | as->pid = current->pid; |
998 | as->uid = current->uid; | ||
999 | as->euid = current->euid; | ||
992 | if (!(uurb->endpoint & USB_DIR_IN)) { | 1000 | if (!(uurb->endpoint & USB_DIR_IN)) { |
993 | if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, as->urb->transfer_buffer_length)) { | 1001 | if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, as->urb->transfer_buffer_length)) { |
994 | free_async(as); | 1002 | free_async(as); |
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c index 640f41e47029..d07bba01995b 100644 --- a/drivers/usb/core/inode.c +++ b/drivers/usb/core/inode.c | |||
@@ -713,7 +713,7 @@ void usbfs_remove_device(struct usb_device *dev) | |||
713 | sinfo.si_errno = EPIPE; | 713 | sinfo.si_errno = EPIPE; |
714 | sinfo.si_code = SI_ASYNCIO; | 714 | sinfo.si_code = SI_ASYNCIO; |
715 | sinfo.si_addr = ds->disccontext; | 715 | sinfo.si_addr = ds->disccontext; |
716 | send_sig_info(ds->discsignr, &sinfo, ds->disctask); | 716 | kill_proc_info_as_uid(ds->discsignr, &sinfo, ds->disc_pid, ds->disc_uid, ds->disc_euid); |
717 | } | 717 | } |
718 | } | 718 | } |
719 | usbfs_update_special(); | 719 | usbfs_update_special(); |
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index 83d48c8133af..e6504f3370ad 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h | |||
@@ -52,7 +52,8 @@ struct dev_state { | |||
52 | struct list_head async_completed; | 52 | struct list_head async_completed; |
53 | wait_queue_head_t wait; /* wake up if a request completed */ | 53 | wait_queue_head_t wait; /* wake up if a request completed */ |
54 | unsigned int discsignr; | 54 | unsigned int discsignr; |
55 | struct task_struct *disctask; | 55 | pid_t disc_pid; |
56 | uid_t disc_uid, disc_euid; | ||
56 | void __user *disccontext; | 57 | void __user *disccontext; |
57 | unsigned long ifclaimed; | 58 | unsigned long ifclaimed; |
58 | }; | 59 | }; |
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c index 41bbae83fc71..e142056b0d2c 100644 --- a/drivers/usb/host/isp116x-hcd.c +++ b/drivers/usb/host/isp116x-hcd.c | |||
@@ -326,7 +326,8 @@ static void postproc_atl_queue(struct isp116x *isp116x) | |||
326 | usb_settoggle(udev, ep->epnum, | 326 | usb_settoggle(udev, ep->epnum, |
327 | ep->nextpid == | 327 | ep->nextpid == |
328 | USB_PID_OUT, | 328 | USB_PID_OUT, |
329 | PTD_GET_TOGGLE(ptd) ^ 1); | 329 | PTD_GET_TOGGLE(ptd)); |
330 | urb->actual_length += PTD_GET_COUNT(ptd); | ||
330 | urb->status = cc_to_error[TD_DATAUNDERRUN]; | 331 | urb->status = cc_to_error[TD_DATAUNDERRUN]; |
331 | spin_unlock(&urb->lock); | 332 | spin_unlock(&urb->lock); |
332 | continue; | 333 | continue; |
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index a99865c689c5..41f92b924761 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c | |||
@@ -1702,10 +1702,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
1702 | if ((endpoint->bmAttributes & 3) != 3) /* Not an interrupt endpoint */ | 1702 | if ((endpoint->bmAttributes & 3) != 3) /* Not an interrupt endpoint */ |
1703 | continue; | 1703 | continue; |
1704 | 1704 | ||
1705 | /* handle potential highspeed HID correctly */ | ||
1706 | interval = endpoint->bInterval; | 1705 | interval = endpoint->bInterval; |
1707 | if (dev->speed == USB_SPEED_HIGH) | ||
1708 | interval = 1 << (interval - 1); | ||
1709 | 1706 | ||
1710 | /* Change the polling interval of mice. */ | 1707 | /* Change the polling interval of mice. */ |
1711 | if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0) | 1708 | if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0) |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index ddde5fb13f6b..5f7d3193d355 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -223,7 +223,7 @@ int usb_serial_generic_write_room (struct usb_serial_port *port) | |||
223 | dbg("%s - port %d", __FUNCTION__, port->number); | 223 | dbg("%s - port %d", __FUNCTION__, port->number); |
224 | 224 | ||
225 | if (serial->num_bulk_out) { | 225 | if (serial->num_bulk_out) { |
226 | if (port->write_urb_busy) | 226 | if (!(port->write_urb_busy)) |
227 | room = port->bulk_out_size; | 227 | room = port->bulk_out_size; |
228 | } | 228 | } |
229 | 229 | ||
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index 6ef6f7760e47..809fee2140ac 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c | |||
@@ -565,7 +565,11 @@ static int vgacon_switch(struct vc_data *c) | |||
565 | scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf, | 565 | scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf, |
566 | c->vc_screenbuf_size > vga_vram_size ? | 566 | c->vc_screenbuf_size > vga_vram_size ? |
567 | vga_vram_size : c->vc_screenbuf_size); | 567 | vga_vram_size : c->vc_screenbuf_size); |
568 | vgacon_doresize(c, c->vc_cols, c->vc_rows); | 568 | if (!(vga_video_num_columns % 2) && |
569 | vga_video_num_columns <= ORIG_VIDEO_COLS && | ||
570 | vga_video_num_lines <= (ORIG_VIDEO_LINES * | ||
571 | vga_default_font_height) / c->vc_font.height) | ||
572 | vgacon_doresize(c, c->vc_cols, c->vc_rows); | ||
569 | } | 573 | } |
570 | 574 | ||
571 | return 0; /* Redrawing not needed */ | 575 | return 0; /* Redrawing not needed */ |
@@ -1023,7 +1027,8 @@ static int vgacon_resize(struct vc_data *c, unsigned int width, | |||
1023 | if (width % 2 || width > ORIG_VIDEO_COLS || | 1027 | if (width % 2 || width > ORIG_VIDEO_COLS || |
1024 | height > (ORIG_VIDEO_LINES * vga_default_font_height)/ | 1028 | height > (ORIG_VIDEO_LINES * vga_default_font_height)/ |
1025 | c->vc_font.height) | 1029 | c->vc_font.height) |
1026 | return -EINVAL; | 1030 | /* let svgatextmode tinker with video timings */ |
1031 | return 0; | ||
1027 | 1032 | ||
1028 | if (CON_IS_VISIBLE(c) && !vga_is_gfx) /* who knows */ | 1033 | if (CON_IS_VISIBLE(c) && !vga_is_gfx) /* who knows */ |
1029 | vgacon_doresize(c, width, height); | 1034 | vgacon_doresize(c, width, height); |
diff --git a/drivers/video/p9100.c b/drivers/video/p9100.c index 7808a01493ad..b76a5a9a125b 100644 --- a/drivers/video/p9100.c +++ b/drivers/video/p9100.c | |||
@@ -288,6 +288,9 @@ static void p9100_init_one(struct sbus_dev *sdev) | |||
288 | all->par.physbase = sdev->reg_addrs[2].phys_addr; | 288 | all->par.physbase = sdev->reg_addrs[2].phys_addr; |
289 | 289 | ||
290 | sbusfb_fill_var(&all->info.var, sdev->prom_node, 8); | 290 | sbusfb_fill_var(&all->info.var, sdev->prom_node, 8); |
291 | all->info.var.red.length = 8; | ||
292 | all->info.var.green.length = 8; | ||
293 | all->info.var.blue.length = 8; | ||
291 | 294 | ||
292 | linebytes = prom_getintdefault(sdev->prom_node, "linebytes", | 295 | linebytes = prom_getintdefault(sdev->prom_node, "linebytes", |
293 | all->info.var.xres); | 296 | all->info.var.xres); |
@@ -323,6 +326,7 @@ static void p9100_init_one(struct sbus_dev *sdev) | |||
323 | kfree(all); | 326 | kfree(all); |
324 | return; | 327 | return; |
325 | } | 328 | } |
329 | fb_set_cmap(&all->info.cmap, &all->info); | ||
326 | 330 | ||
327 | list_add(&all->list, &p9100_list); | 331 | list_add(&all->list, &p9100_list); |
328 | 332 | ||
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c index beeec7b51425..8000890e4271 100644 --- a/drivers/video/sa1100fb.c +++ b/drivers/video/sa1100fb.c | |||
@@ -592,6 +592,7 @@ sa1100fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
592 | return ret; | 592 | return ret; |
593 | } | 593 | } |
594 | 594 | ||
595 | #ifdef CONFIG_CPU_FREQ | ||
595 | /* | 596 | /* |
596 | * sa1100fb_display_dma_period() | 597 | * sa1100fb_display_dma_period() |
597 | * Calculate the minimum period (in picoseconds) between two DMA | 598 | * Calculate the minimum period (in picoseconds) between two DMA |
@@ -606,6 +607,7 @@ static inline unsigned int sa1100fb_display_dma_period(struct fb_var_screeninfo | |||
606 | */ | 607 | */ |
607 | return var->pixclock * 8 * 16 / var->bits_per_pixel; | 608 | return var->pixclock * 8 * 16 / var->bits_per_pixel; |
608 | } | 609 | } |
610 | #endif | ||
609 | 611 | ||
610 | /* | 612 | /* |
611 | * sa1100fb_check_var(): | 613 | * sa1100fb_check_var(): |
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index 1b6b74c116a9..14016b1cd948 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c | |||
@@ -77,8 +77,7 @@ static void w1_master_release(struct device *dev) | |||
77 | 77 | ||
78 | dev_dbg(dev, "%s: Releasing %s.\n", __func__, md->name); | 78 | dev_dbg(dev, "%s: Releasing %s.\n", __func__, md->name); |
79 | 79 | ||
80 | if (md->nls && md->nls->sk_socket) | 80 | dev_fini_netlink(md); |
81 | sock_release(md->nls->sk_socket); | ||
82 | memset(md, 0, sizeof(struct w1_master) + sizeof(struct w1_bus_master)); | 81 | memset(md, 0, sizeof(struct w1_master) + sizeof(struct w1_bus_master)); |
83 | kfree(md); | 82 | kfree(md); |
84 | } | 83 | } |