]>
Commit | Line | Data |
---|---|---|
09d0ed4d | 1 | diff -uNr -X exclude linux-2.6.0-test11/arch/i386/kernel/mpparse.c linux/arch/i386/kernel/mpparse.c |
2 | --- linux-2.6.0-test11/arch/i386/kernel/mpparse.c 2003-12-08 00:29:12.000000000 +0100 | |
3 | +++ linux/arch/i386/kernel/mpparse.c 2003-12-08 00:33:52.671960352 +0100 | |
4 | @@ -962,7 +962,8 @@ | |
5 | */ | |
6 | for (i = 0; i < mp_irq_entries; i++) { | |
7 | if ((mp_irqs[i].mpc_dstapic == intsrc.mpc_dstapic) | |
8 | - && (mp_irqs[i].mpc_srcbusirq == intsrc.mpc_srcbusirq)) { | |
9 | + && (mp_irqs[i].mpc_srcbusirq == intsrc.mpc_srcbusirq) | |
10 | + && (mp_irqs[i].mpc_irqtype == intsrc.mpc_irqtype)) { | |
11 | mp_irqs[i] = intsrc; | |
12 | found = 1; | |
13 | break; | |
14 | diff -uNr -X exclude linux-2.6.0-test11/arch/i386/pci/fixup.c linux/arch/i386/pci/fixup.c | |
15 | --- linux-2.6.0-test11/arch/i386/pci/fixup.c 2003-12-08 00:29:12.000000000 +0100 | |
16 | +++ linux/arch/i386/pci/fixup.c 2003-12-08 00:33:52.521983152 +0100 | |
17 | @@ -187,6 +187,22 @@ | |
18 | dev->transparent = 1; | |
19 | } | |
20 | ||
21 | +/* | |
22 | + * Halt Disconnect and Stop Grant Disconnect (bit 4 at offset 0x6F) | |
23 | + * must be disabled when APIC is used (or lockups will happen). | |
24 | + */ | |
25 | +static void __devinit pci_fixup_nforce2_disconnect(struct pci_dev *d) | |
26 | +{ | |
27 | + u8 t; | |
28 | + | |
29 | + pci_read_config_byte(d, 0x6F, &t); | |
30 | + if (t & 0x10) { | |
31 | + printk(KERN_INFO "PCI: disabling nForce2 Halt Disconnect" | |
32 | + " and Stop Grant Disconnect\n"); | |
33 | + pci_write_config_byte(d, 0x6F, (t & 0xef)); | |
34 | + } | |
35 | +} | |
36 | + | |
37 | struct pci_fixup pcibios_fixups[] = { | |
38 | { PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82451NX, pci_fixup_i450nx }, | |
39 | { PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454GX, pci_fixup_i450gx }, | |
40 | @@ -205,5 +221,6 @@ | |
41 | { PCI_FIXUP_HEADER, PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8367_0, pci_fixup_via_northbridge_bug }, | |
42 | { PCI_FIXUP_HEADER, PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, pci_fixup_ncr53c810 }, | |
43 | { PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_fixup_transparent_bridge }, | |
44 | + { PCI_FIXUP_HEADER, PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2, pci_fixup_nforce2_disconnect }, | |
45 | { 0 } | |
46 | }; | |
47 | diff -uNr -X exclude linux-2.6.0-test11/drivers/block/ll_rw_blk.c linux/drivers/block/ll_rw_blk.c | |
48 | --- linux-2.6.0-test11/drivers/block/ll_rw_blk.c 2003-12-08 00:29:13.000000000 +0100 | |
49 | +++ linux/drivers/block/ll_rw_blk.c 2003-12-08 00:33:51.201183944 +0100 | |
50 | @@ -780,11 +780,6 @@ | |
51 | "REQ_PM_SUSPEND", | |
52 | "REQ_PM_RESUME", | |
53 | "REQ_PM_SHUTDOWN", | |
54 | - "REQ_IDETAPE_PC1", | |
55 | - "REQ_IDETAPE_PC2", | |
56 | - "REQ_IDETAPE_READ", | |
57 | - "REQ_IDETAPE_WRITE", | |
58 | - "REQ_IDETAPE_READ_BUFFER", | |
59 | }; | |
60 | ||
61 | void blk_dump_rq_flags(struct request *rq, char *msg) | |
62 | diff -uNr -X exclude linux-2.6.0-test11/drivers/ide/ide-io.c linux/drivers/ide/ide-io.c | |
63 | --- linux-2.6.0-test11/drivers/ide/ide-io.c 2003-12-08 00:29:12.000000000 +0100 | |
64 | +++ linux/drivers/ide/ide-io.c 2003-12-08 00:33:52.834935576 +0100 | |
65 | @@ -54,37 +54,6 @@ | |
66 | #include <asm/io.h> | |
67 | #include <asm/bitops.h> | |
68 | ||
69 | -#if (DISK_RECOVERY_TIME > 0) | |
70 | - | |
71 | -#error So the User Has To Fix the Compilation And Stop Hacking Port 0x43. Does anyone ever use this anyway ?? | |
72 | - | |
73 | -/* | |
74 | - * For really screwy hardware (hey, at least it *can* be used with Linux) | |
75 | - * we can enforce a minimum delay time between successive operations. | |
76 | - */ | |
77 | -static unsigned long read_timer (ide_hwif_t *hwif) | |
78 | -{ | |
79 | - unsigned long t, flags; | |
80 | - int i; | |
81 | - | |
82 | - /* FIXME this is completely unsafe! */ | |
83 | - local_irq_save(flags); | |
84 | - t = jiffies * 11932; | |
85 | - outb_p(0, 0x43); | |
86 | - i = inb_p(0x40); | |
87 | - i |= inb_p(0x40) << 8; | |
88 | - local_irq_restore(flags); | |
89 | - return (t - i); | |
90 | -} | |
91 | -#endif /* DISK_RECOVERY_TIME */ | |
92 | - | |
93 | -static inline void set_recovery_timer (ide_hwif_t *hwif) | |
94 | -{ | |
95 | -#if (DISK_RECOVERY_TIME > 0) | |
96 | - hwif->last_time = read_timer(hwif); | |
97 | -#endif /* DISK_RECOVERY_TIME */ | |
98 | -} | |
99 | - | |
100 | /** | |
101 | * ide_end_request - complete an IDE I/O | |
102 | * @drive: IDE device for the I/O | |
103 | @@ -653,10 +622,6 @@ | |
104 | if (block == 0 && drive->remap_0_to_1 == 1) | |
105 | block = 1; /* redirect MBR access to EZ-Drive partn table */ | |
106 | ||
107 | -#if (DISK_RECOVERY_TIME > 0) | |
108 | - while ((read_timer() - HWIF(drive)->last_time) < DISK_RECOVERY_TIME); | |
109 | -#endif | |
110 | - | |
111 | if (blk_pm_suspend_request(rq) && | |
112 | rq->pm->pm_step == ide_pm_state_start_suspend) | |
113 | /* Mark drive blocked when starting the suspend sequence. */ | |
114 | @@ -1116,7 +1081,6 @@ | |
115 | startstop = | |
116 | DRIVER(drive)->error(drive, "irq timeout", hwif->INB(IDE_STATUS_REG)); | |
117 | } | |
118 | - set_recovery_timer(hwif); | |
119 | drive->service_time = jiffies - drive->service_start; | |
120 | spin_lock_irq(&ide_lock); | |
121 | enable_irq(hwif->irq); | |
122 | @@ -1313,7 +1277,6 @@ | |
123 | * same irq as is currently being serviced here, and Linux | |
124 | * won't allow another of the same (on any CPU) until we return. | |
125 | */ | |
126 | - set_recovery_timer(HWIF(drive)); | |
127 | drive->service_time = jiffies - drive->service_start; | |
128 | if (startstop == ide_stopped) { | |
129 | if (hwgroup->handler == NULL) { /* paranoia */ | |
130 | diff -uNr -X exclude linux-2.6.0-test11/drivers/ide/ide-tape.c linux/drivers/ide/ide-tape.c | |
131 | --- linux-2.6.0-test11/drivers/ide/ide-tape.c 2003-12-08 00:29:13.000000000 +0100 | |
132 | +++ linux/drivers/ide/ide-tape.c 2003-12-08 00:33:51.207183032 +0100 | |
133 | @@ -1,5 +1,5 @@ | |
134 | /* | |
135 | - * linux/drivers/ide/ide-tape.c Version 1.17b Oct, 2002 | |
136 | + * linux/drivers/ide/ide-tape.c Version 1.19 Nov, 2003 | |
137 | * | |
138 | * Copyright (C) 1995 - 1999 Gadi Oxman <gadio@netvision.net.il> | |
139 | * | |
140 | @@ -422,7 +422,7 @@ | |
141 | * sharing a (fast) ATA-2 disk with any (slow) new ATAPI device. | |
142 | */ | |
143 | ||
144 | -#define IDETAPE_VERSION "1.17b-ac1" | |
145 | +#define IDETAPE_VERSION "1.19" | |
146 | ||
147 | #include <linux/config.h> | |
148 | #include <linux/module.h> | |
149 | @@ -450,9 +450,6 @@ | |
150 | #include <asm/unaligned.h> | |
151 | #include <asm/bitops.h> | |
152 | ||
153 | - | |
154 | -#define NO_LONGER_REQUIRED (1) | |
155 | - | |
156 | /* | |
157 | * OnStream support | |
158 | */ | |
159 | @@ -652,9 +649,11 @@ | |
160 | #define IDETAPE_PC_STACK (10 + IDETAPE_MAX_PC_RETRIES) | |
161 | ||
162 | /* | |
163 | - * Some tape drives require a long irq timeout | |
164 | + * Some drives (for example, Seagate STT3401A Travan) require a very long | |
165 | + * timeout, because they don't return an interrupt or clear their busy bit | |
166 | + * until after the command completes (even retension commands). | |
167 | */ | |
168 | -#define IDETAPE_WAIT_CMD (60*HZ) | |
169 | +#define IDETAPE_WAIT_CMD (900*HZ) | |
170 | ||
171 | /* | |
172 | * The following parameter is used to select the point in the internal | |
173 | @@ -1032,6 +1031,10 @@ | |
174 | ||
175 | /* the door is currently locked */ | |
176 | int door_locked; | |
177 | + /* the tape hardware is write protected */ | |
178 | + char drv_write_prot; | |
179 | + /* the tape is write protected (hardware or opened as read-only) */ | |
180 | + char write_prot; | |
181 | ||
182 | /* | |
183 | * OnStream flags | |
184 | @@ -1164,6 +1167,8 @@ | |
185 | #define IDETAPE_DRQ_INTERRUPT 6 /* DRQ interrupt device */ | |
186 | #define IDETAPE_READ_ERROR 7 | |
187 | #define IDETAPE_PIPELINE_ACTIVE 8 /* pipeline active */ | |
188 | +/* 0 = no tape is loaded, so we don't rewind after ejecting */ | |
189 | +#define IDETAPE_MEDIUM_PRESENT 9 | |
190 | ||
191 | /* | |
192 | * Supported ATAPI tape drives packet commands | |
193 | @@ -1211,10 +1216,14 @@ | |
194 | * requests to the tail of our block device request queue and wait | |
195 | * for their completion. | |
196 | */ | |
197 | -#define idetape_request(rq) \ | |
198 | - ((rq)->flags & (REQ_IDETAPE_PC1 | REQ_IDETAPE_PC2 | \ | |
199 | - REQ_IDETAPE_READ | REQ_IDETAPE_WRITE | \ | |
200 | - REQ_IDETAPE_READ_BUFFER)) | |
201 | + | |
202 | +enum { | |
203 | + REQ_IDETAPE_PC1 = (1 << 0), /* packet command (first stage) */ | |
204 | + REQ_IDETAPE_PC2 = (1 << 1), /* packet command (second stage) */ | |
205 | + REQ_IDETAPE_READ = (1 << 2), | |
206 | + REQ_IDETAPE_WRITE = (1 << 3), | |
207 | + REQ_IDETAPE_READ_BUFFER = (1 << 4), | |
208 | +}; | |
209 | ||
210 | /* | |
211 | * Error codes which are returned in rq->errors to the higher part | |
212 | @@ -1665,6 +1674,20 @@ | |
213 | idetape_update_buffers(pc); | |
214 | } | |
215 | ||
216 | + /* | |
217 | + * If error was the result of a zero-length read or write command, | |
218 | + * with sense key=5, asc=0x22, ascq=0, let it slide. Some drives | |
219 | + * (i.e. Seagate STT3401A Travan) don't support 0-length read/writes. | |
220 | + */ | |
221 | + if ((pc->c[0] == IDETAPE_READ_CMD || pc->c[0] == IDETAPE_WRITE_CMD) | |
222 | + && pc->c[4] == 0 && pc->c[3] == 0 && pc->c[2] == 0) { /* length==0 */ | |
223 | + if (result->sense_key == 5) { | |
224 | + /* don't report an error, everything's ok */ | |
225 | + pc->error = 0; | |
226 | + /* don't retry read/write */ | |
227 | + set_bit(PC_ABORT, &pc->flags); | |
228 | + } | |
229 | + } | |
230 | if (pc->c[0] == IDETAPE_READ_CMD && result->filemark) { | |
231 | pc->error = IDETAPE_ERROR_FILEMARK; | |
232 | set_bit(PC_ABORT, &pc->flags); | |
233 | @@ -1805,10 +1828,15 @@ | |
234 | } | |
235 | } | |
236 | ||
237 | -static void idetape_abort_pipeline (ide_drive_t *drive, idetape_stage_t *last_stage) | |
238 | +/* | |
239 | + * This will free all the pipeline stages starting from new_last_stage->next | |
240 | + * to the end of the list, and point tape->last_stage to new_last_stage. | |
241 | + */ | |
242 | +static void idetape_abort_pipeline(ide_drive_t *drive, | |
243 | + idetape_stage_t *new_last_stage) | |
244 | { | |
245 | idetape_tape_t *tape = drive->driver_data; | |
246 | - idetape_stage_t *stage = tape->next_stage; | |
247 | + idetape_stage_t *stage = new_last_stage->next; | |
248 | idetape_stage_t *nstage; | |
249 | ||
250 | #if IDETAPE_DEBUG_LOG | |
251 | @@ -1822,9 +1850,9 @@ | |
252 | --tape->nr_pending_stages; | |
253 | stage = nstage; | |
254 | } | |
255 | - tape->last_stage = last_stage; | |
256 | - if (last_stage) | |
257 | - last_stage->next = NULL; | |
258 | + if (new_last_stage) | |
259 | + new_last_stage->next = NULL; | |
260 | + tape->last_stage = new_last_stage; | |
261 | tape->next_stage = NULL; | |
262 | } | |
263 | ||
264 | @@ -1868,7 +1896,7 @@ | |
265 | tape->active_stage = NULL; | |
266 | tape->active_data_request = NULL; | |
267 | tape->nr_pending_stages--; | |
268 | - if (rq->flags & REQ_IDETAPE_WRITE) { | |
269 | + if (rq->cmd[0] & REQ_IDETAPE_WRITE) { | |
270 | #if ONSTREAM_DEBUG | |
271 | if (tape->debug_level >= 2) { | |
272 | if (tape->onstream) { | |
273 | @@ -1914,7 +1942,7 @@ | |
274 | } | |
275 | } | |
276 | } | |
277 | - } else if (rq->flags & REQ_IDETAPE_READ) { | |
278 | + } else if (rq->cmd[0] & REQ_IDETAPE_READ) { | |
279 | if (error == IDETAPE_ERROR_EOD) { | |
280 | set_bit(IDETAPE_PIPELINE_ERROR, &tape->flags); | |
281 | idetape_abort_pipeline(drive, active_stage); | |
282 | @@ -1972,6 +2000,13 @@ | |
283 | pc->callback = &idetape_request_sense_callback; | |
284 | } | |
285 | ||
286 | +static void idetape_init_rq(struct request *rq, u8 cmd) | |
287 | +{ | |
288 | + memset(rq, 0, sizeof(*rq)); | |
289 | + rq->flags = REQ_SPECIAL; | |
290 | + rq->cmd[0] = cmd; | |
291 | +} | |
292 | + | |
293 | /* | |
294 | * idetape_queue_pc_head generates a new packet command request in front | |
295 | * of the request queue, before the current request, so that it will be | |
296 | @@ -1993,8 +2028,7 @@ | |
297 | */ | |
298 | static void idetape_queue_pc_head (ide_drive_t *drive, idetape_pc_t *pc,struct request *rq) | |
299 | { | |
300 | - memset(rq, 0, sizeof(*rq)); | |
301 | - rq->flags = REQ_IDETAPE_PC1; | |
302 | + idetape_init_rq(rq, REQ_IDETAPE_PC1); | |
303 | rq->buffer = (char *) pc; | |
304 | (void) ide_do_drive_cmd(drive, rq, ide_preempt); | |
305 | } | |
306 | @@ -2430,7 +2464,14 @@ | |
307 | if (page_code != IDETAPE_BLOCK_DESCRIPTOR) | |
308 | pc->c[1] = 8; /* DBD = 1 - Don't return block descriptors */ | |
309 | pc->c[2] = page_code; | |
310 | - pc->c[3] = 255; /* Don't limit the returned information */ | |
311 | + /* | |
312 | + * Changed pc->c[3] to 0 (255 will at best return unused info). | |
313 | + * | |
314 | + * For SCSI this byte is defined as subpage instead of high byte | |
315 | + * of length and some IDE drives seem to interpret it this way | |
316 | + * and return an error when 255 is used. | |
317 | + */ | |
318 | + pc->c[3] = 0; | |
319 | pc->c[4] = 255; /* (We will just discard data in that case) */ | |
320 | if (page_code == IDETAPE_BLOCK_DESCRIPTOR) | |
321 | pc->request_transfer = 12; | |
322 | @@ -2544,8 +2585,9 @@ | |
323 | if (status.b.dsc) { | |
324 | if (status.b.check) { | |
325 | /* Error detected */ | |
326 | - printk(KERN_ERR "ide-tape: %s: I/O error, ",tape->name); | |
327 | - | |
328 | + if (pc->c[0] != IDETAPE_TEST_UNIT_READY_CMD) | |
329 | + printk(KERN_ERR "ide-tape: %s: I/O error, ", | |
330 | + tape->name); | |
331 | /* Retry operation */ | |
332 | return idetape_retry_pc(drive); | |
333 | } | |
334 | @@ -2697,7 +2739,7 @@ | |
335 | if (tape->debug_level >= 5) | |
336 | printk(KERN_INFO "ide-tape: rq_status: %d, " | |
337 | "dev: %s, cmd: %ld, errors: %d\n", rq->rq_status, | |
338 | - rq->rq_disk->disk_name, rq->flags, rq->errors); | |
339 | + rq->rq_disk->disk_name, rq->cmd[0], rq->errors); | |
340 | #endif | |
341 | if (tape->debug_level >= 2) | |
342 | printk(KERN_INFO "ide-tape: sector: %ld, " | |
343 | @@ -2705,11 +2747,11 @@ | |
344 | rq->sector, rq->nr_sectors, rq->current_nr_sectors); | |
345 | #endif /* IDETAPE_DEBUG_LOG */ | |
346 | ||
347 | - if (!idetape_request(rq)) { | |
348 | + if ((rq->flags & REQ_SPECIAL) == 0) { | |
349 | /* | |
350 | * We do not support buffer cache originated requests. | |
351 | */ | |
352 | - printk(KERN_NOTICE "ide-tape: %s: Unsupported command in " | |
353 | + printk(KERN_NOTICE "ide-tape: %s: Unsupported request in " | |
354 | "request queue (%ld)\n", drive->name, rq->flags); | |
355 | ide_end_request(drive, 0, 0); | |
356 | return ide_stopped; | |
357 | @@ -2746,7 +2788,7 @@ | |
358 | */ | |
359 | if (tape->onstream) | |
360 | status.b.dsc = 1; | |
361 | - if (!drive->dsc_overlap && !(rq->flags & REQ_IDETAPE_PC2)) | |
362 | + if (!drive->dsc_overlap && !(rq->cmd[0] & REQ_IDETAPE_PC2)) | |
363 | set_bit(IDETAPE_IGNORE_DSC, &tape->flags); | |
364 | ||
365 | /* | |
366 | @@ -2760,7 +2802,7 @@ | |
367 | if (tape->tape_still_time > 100 && tape->tape_still_time < 200) | |
368 | tape->measure_insert_time = 1; | |
369 | if (tape->req_buffer_fill && | |
370 | - (rq->flags & (REQ_IDETAPE_WRITE | REQ_IDETAPE_READ))) { | |
371 | + (rq->cmd[0] & (REQ_IDETAPE_WRITE | REQ_IDETAPE_READ))) { | |
372 | tape->req_buffer_fill = 0; | |
373 | tape->writes_since_buffer_fill = 0; | |
374 | tape->reads_since_buffer_fill = 0; | |
375 | @@ -2774,12 +2816,12 @@ | |
376 | tape->insert_speed = tape->insert_size / 1024 * HZ / (jiffies - tape->insert_time); | |
377 | calculate_speeds(drive); | |
378 | if (tape->onstream && tape->max_frames && | |
379 | - (((rq->flags & REQ_IDETAPE_WRITE) && | |
380 | + (((rq->cmd[0] & REQ_IDETAPE_WRITE) && | |
381 | ( tape->cur_frames == tape->max_frames || | |
382 | ( tape->speed_control && tape->cur_frames > 5 && | |
383 | (tape->insert_speed > tape->max_insert_speed || | |
384 | (0 /* tape->cur_frames > 30 && tape->tape_still_time > 200 */) ) ) ) ) || | |
385 | - ((rq->flags & REQ_IDETAPE_READ) && | |
386 | + ((rq->cmd[0] & REQ_IDETAPE_READ) && | |
387 | ( tape->cur_frames == 0 || | |
388 | ( tape->speed_control && (tape->cur_frames < tape->max_frames - 5) && | |
389 | tape->insert_speed > tape->max_insert_speed ) ) && rq->nr_sectors) ) ) { | |
390 | @@ -2787,7 +2829,7 @@ | |
391 | if (tape->debug_level >= 4) | |
392 | printk(KERN_INFO "ide-tape: postponing request, " | |
393 | "cmd %ld, cur %d, max %d\n", | |
394 | - rq->flags, tape->cur_frames, tape->max_frames); | |
395 | + rq->cmd[0], tape->cur_frames, tape->max_frames); | |
396 | #endif | |
397 | if (tape->postpone_cnt++ < 500) { | |
398 | status.b.dsc = 0; | |
399 | @@ -2808,7 +2850,7 @@ | |
400 | } else if ((signed long) (jiffies - tape->dsc_timeout) > 0) { | |
401 | printk(KERN_ERR "ide-tape: %s: DSC timeout\n", | |
402 | tape->name); | |
403 | - if (rq->flags & REQ_IDETAPE_PC2) { | |
404 | + if (rq->cmd[0] & REQ_IDETAPE_PC2) { | |
405 | idetape_media_access_finished(drive); | |
406 | return ide_stopped; | |
407 | } else { | |
408 | @@ -2819,7 +2861,7 @@ | |
409 | idetape_postpone_request(drive); | |
410 | return ide_stopped; | |
411 | } | |
412 | - if (rq->flags & REQ_IDETAPE_READ) { | |
413 | + if (rq->cmd[0] & REQ_IDETAPE_READ) { | |
414 | tape->buffer_head++; | |
415 | #if USE_IOTRACE | |
416 | IO_trace(IO_IDETAPE_FIFO, tape->pipeline_head, tape->buffer_head, tape->tape_head, tape->minor); | |
417 | @@ -2836,7 +2878,7 @@ | |
418 | idetape_create_read_cmd(tape, pc, rq->current_nr_sectors, (struct idetape_bh *)rq->special); | |
419 | goto out; | |
420 | } | |
421 | - if (rq->flags & REQ_IDETAPE_WRITE) { | |
422 | + if (rq->cmd[0] & REQ_IDETAPE_WRITE) { | |
423 | tape->buffer_head++; | |
424 | #if USE_IOTRACE | |
425 | IO_trace(IO_IDETAPE_FIFO, tape->pipeline_head, tape->buffer_head, tape->tape_head, tape->minor); | |
426 | @@ -2854,19 +2896,19 @@ | |
427 | idetape_create_write_cmd(tape, pc, rq->current_nr_sectors, (struct idetape_bh *)rq->special); | |
428 | goto out; | |
429 | } | |
430 | - if (rq->flags & REQ_IDETAPE_READ_BUFFER) { | |
431 | + if (rq->cmd[0] & REQ_IDETAPE_READ_BUFFER) { | |
432 | tape->postpone_cnt = 0; | |
433 | pc = idetape_next_pc_storage(drive); | |
434 | idetape_create_read_buffer_cmd(tape, pc, rq->current_nr_sectors, (struct idetape_bh *)rq->special); | |
435 | goto out; | |
436 | } | |
437 | - if (rq->flags & REQ_IDETAPE_PC1) { | |
438 | + if (rq->cmd[0] & REQ_IDETAPE_PC1) { | |
439 | pc = (idetape_pc_t *) rq->buffer; | |
440 | - rq->flags &= ~(REQ_IDETAPE_PC1); | |
441 | - rq->flags |= REQ_IDETAPE_PC2; | |
442 | + rq->cmd[0] &= ~(REQ_IDETAPE_PC1); | |
443 | + rq->cmd[0] |= REQ_IDETAPE_PC2; | |
444 | goto out; | |
445 | } | |
446 | - if (rq->flags & REQ_IDETAPE_PC2) { | |
447 | + if (rq->cmd[0] & REQ_IDETAPE_PC2) { | |
448 | idetape_media_access_finished(drive); | |
449 | return ide_stopped; | |
450 | } | |
451 | @@ -3163,7 +3205,7 @@ | |
452 | idetape_tape_t *tape = drive->driver_data; | |
453 | ||
454 | #if IDETAPE_DEBUG_BUGS | |
455 | - if (rq == NULL || !idetape_request(rq)) { | |
456 | + if (rq == NULL || (rq->flags & REQ_SPECIAL) == 0) { | |
457 | printk (KERN_ERR "ide-tape: bug: Trying to sleep on non-valid request\n"); | |
458 | return; | |
459 | } | |
460 | @@ -3269,8 +3311,7 @@ | |
461 | { | |
462 | struct request rq; | |
463 | ||
464 | - memset(&rq, 0, sizeof(rq)); | |
465 | - rq.flags = REQ_IDETAPE_PC1; | |
466 | + idetape_init_rq(&rq, REQ_IDETAPE_PC1); | |
467 | rq.buffer = (char *) pc; | |
468 | return ide_do_drive_cmd(drive, &rq, ide_wait); | |
469 | } | |
470 | @@ -3295,25 +3336,28 @@ | |
471 | { | |
472 | idetape_tape_t *tape = drive->driver_data; | |
473 | idetape_pc_t pc; | |
474 | + int load_attempted = 0; | |
475 | ||
476 | /* | |
477 | * Wait for the tape to become ready | |
478 | */ | |
479 | + set_bit(IDETAPE_MEDIUM_PRESENT, &tape->flags); | |
480 | timeout += jiffies; | |
481 | while (time_before(jiffies, timeout)) { | |
482 | idetape_create_test_unit_ready_cmd(&pc); | |
483 | if (!__idetape_queue_pc_tail(drive, &pc)) | |
484 | return 0; | |
485 | - if (tape->sense_key == 2 && tape->asc == 4 && tape->ascq == 2) { | |
486 | + if ((tape->sense_key == 2 && tape->asc == 4 && tape->ascq == 2) | |
487 | + || (tape->asc == 0x3A)) { /* no media */ | |
488 | + if (load_attempted) | |
489 | + return -ENOMEDIUM; | |
490 | idetape_create_load_unload_cmd(drive, &pc, IDETAPE_LU_LOAD_MASK); | |
491 | __idetape_queue_pc_tail(drive, &pc); | |
492 | - idetape_create_test_unit_ready_cmd(&pc); | |
493 | - if (!__idetape_queue_pc_tail(drive, &pc)) | |
494 | - return 0; | |
495 | - } | |
496 | - if (!(tape->sense_key == 2 && tape->asc == 4 && | |
497 | - (tape->ascq == 1 || tape->ascq == 8))) | |
498 | - break; | |
499 | + load_attempted = 1; | |
500 | + /* not about to be ready */ | |
501 | + } else if (!(tape->sense_key == 2 && tape->asc == 4 && | |
502 | + (tape->ascq == 1 || tape->ascq == 8))) | |
503 | + return -EIO; | |
504 | current->state = TASK_INTERRUPTIBLE; | |
505 | schedule_timeout(HZ / 10); | |
506 | } | |
507 | @@ -3369,25 +3413,10 @@ | |
508 | printk(KERN_INFO "ide-tape: Reached idetape_read_position\n"); | |
509 | #endif /* IDETAPE_DEBUG_LOG */ | |
510 | ||
511 | -#ifdef NO_LONGER_REQUIRED | |
512 | - idetape_flush_tape_buffers(drive); | |
513 | -#endif | |
514 | idetape_create_read_position_cmd(&pc); | |
515 | if (idetape_queue_pc_tail(drive, &pc)) | |
516 | return -1; | |
517 | position = tape->first_frame_position; | |
518 | -#ifdef NO_LONGER_REQUIRED | |
519 | - if (tape->onstream) { | |
520 | - if ((position != tape->last_frame_position - tape->blocks_in_buffer) && | |
521 | - (position != tape->last_frame_position + tape->blocks_in_buffer)) { | |
522 | - if (tape->blocks_in_buffer == 0) { | |
523 | - printk("ide-tape: %s: correcting read position %d, %d, %d\n", tape->name, position, tape->last_frame_position, tape->blocks_in_buffer); | |
524 | - position = tape->last_frame_position; | |
525 | - tape->first_frame_position = position; | |
526 | - } | |
527 | - } | |
528 | - } | |
529 | -#endif | |
530 | return position; | |
531 | } | |
532 | ||
533 | @@ -3436,6 +3465,8 @@ | |
534 | ||
535 | if (tape->chrdev_direction != idetape_direction_read) | |
536 | return 0; | |
537 | + | |
538 | + /* Remove merge stage. */ | |
539 | cnt = tape->merge_stage_size / tape->tape_block_size; | |
540 | if (test_and_clear_bit(IDETAPE_FILEMARK, &tape->flags)) | |
541 | ++cnt; /* Filemarks count as 1 sector */ | |
542 | @@ -3444,9 +3475,12 @@ | |
543 | __idetape_kfree_stage(tape->merge_stage); | |
544 | tape->merge_stage = NULL; | |
545 | } | |
546 | + | |
547 | + /* Clear pipeline flags. */ | |
548 | clear_bit(IDETAPE_PIPELINE_ERROR, &tape->flags); | |
549 | tape->chrdev_direction = idetape_direction_none; | |
550 | - | |
551 | + | |
552 | + /* Remove pipeline stages. */ | |
553 | if (tape->first_stage == NULL) | |
554 | return 0; | |
555 | ||
556 | @@ -3546,8 +3580,7 @@ | |
557 | } | |
558 | #endif /* IDETAPE_DEBUG_BUGS */ | |
559 | ||
560 | - memset(&rq, 0, sizeof(rq)); | |
561 | - rq.flags = cmd; | |
562 | + idetape_init_rq(&rq, cmd); | |
563 | rq.special = (void *)bh; | |
564 | rq.sector = tape->first_frame_position; | |
565 | rq.nr_sectors = rq.current_nr_sectors = blocks; | |
566 | @@ -3596,8 +3629,7 @@ | |
567 | printk(KERN_INFO "ide-tape: %s: read back logical block %d, data %x %x %x %x\n", tape->name, logical_blk_num, *p++, *p++, *p++, *p++); | |
568 | #endif | |
569 | rq = &stage->rq; | |
570 | - memset(rq, 0, sizeof(*rq)); | |
571 | - rq->flags = REQ_IDETAPE_WRITE; | |
572 | + idetape_init_rq(rq, REQ_IDETAPE_WRITE); | |
573 | rq->sector = tape->first_frame_position; | |
574 | rq->nr_sectors = rq->current_nr_sectors = tape->capabilities.ctl; | |
575 | idetape_init_stage(drive, stage, OS_FRAME_TYPE_DATA, logical_blk_num++); | |
576 | @@ -3871,8 +3903,7 @@ | |
577 | } | |
578 | } | |
579 | rq = &new_stage->rq; | |
580 | - memset(rq, 0, sizeof(*rq)); | |
581 | - rq->flags = REQ_IDETAPE_WRITE; | |
582 | + idetape_init_rq(rq, REQ_IDETAPE_WRITE); | |
583 | /* Doesn't actually matter - We always assume sequential access */ | |
584 | rq->sector = tape->first_frame_position; | |
585 | rq->nr_sectors = rq->current_nr_sectors = blocks; | |
586 | @@ -4059,19 +4090,22 @@ | |
587 | * Issue a read 0 command to ensure that DSC handshake | |
588 | * is switched from completion mode to buffer available | |
589 | * mode. | |
590 | + * No point in issuing this if DSC overlap isn't supported, | |
591 | + * some drives (Seagate STT3401A) will return an error. | |
592 | */ | |
593 | - bytes_read = idetape_queue_rw_tail(drive, REQ_IDETAPE_READ, 0, tape->merge_stage->bh); | |
594 | - if (bytes_read < 0) { | |
595 | - __idetape_kfree_stage(tape->merge_stage); | |
596 | - tape->merge_stage = NULL; | |
597 | - tape->chrdev_direction = idetape_direction_none; | |
598 | - return bytes_read; | |
599 | + if (drive->dsc_overlap) { | |
600 | + bytes_read = idetape_queue_rw_tail(drive, REQ_IDETAPE_READ, 0, tape->merge_stage->bh); | |
601 | + if (bytes_read < 0) { | |
602 | + __idetape_kfree_stage(tape->merge_stage); | |
603 | + tape->merge_stage = NULL; | |
604 | + tape->chrdev_direction = idetape_direction_none; | |
605 | + return bytes_read; | |
606 | + } | |
607 | } | |
608 | } | |
609 | if (tape->restart_speed_control_req) | |
610 | idetape_restart_speed_control(drive); | |
611 | - memset(&rq, 0, sizeof(rq)); | |
612 | - rq.flags = REQ_IDETAPE_READ; | |
613 | + idetape_init_rq(&rq, REQ_IDETAPE_READ); | |
614 | rq.sector = tape->first_frame_position; | |
615 | rq.nr_sectors = rq.current_nr_sectors = blocks; | |
616 | if (!test_bit(IDETAPE_PIPELINE_ERROR, &tape->flags) && | |
617 | @@ -4898,6 +4932,10 @@ | |
618 | return -ENXIO; | |
619 | } | |
620 | ||
621 | + /* The drive is write protected. */ | |
622 | + if (tape->write_prot) | |
623 | + return -EACCES; | |
624 | + | |
625 | #if IDETAPE_DEBUG_LOG | |
626 | if (tape->debug_level >= 3) | |
627 | printk(KERN_INFO "ide-tape: Reached idetape_chrdev_write, " | |
628 | @@ -4979,13 +5017,17 @@ | |
629 | * Issue a write 0 command to ensure that DSC handshake | |
630 | * is switched from completion mode to buffer available | |
631 | * mode. | |
632 | + * No point in issuing this if DSC overlap isn't supported, | |
633 | + * some drives (Seagate STT3401A) will return an error. | |
634 | */ | |
635 | - retval = idetape_queue_rw_tail(drive, REQ_IDETAPE_WRITE, 0, tape->merge_stage->bh); | |
636 | - if (retval < 0) { | |
637 | - __idetape_kfree_stage(tape->merge_stage); | |
638 | - tape->merge_stage = NULL; | |
639 | - tape->chrdev_direction = idetape_direction_none; | |
640 | - return retval; | |
641 | + if (drive->dsc_overlap) { | |
642 | + retval = idetape_queue_rw_tail(drive, REQ_IDETAPE_WRITE, 0, tape->merge_stage->bh); | |
643 | + if (retval < 0) { | |
644 | + __idetape_kfree_stage(tape->merge_stage); | |
645 | + tape->merge_stage = NULL; | |
646 | + tape->chrdev_direction = idetape_direction_none; | |
647 | + return retval; | |
648 | + } | |
649 | } | |
650 | #if ONSTREAM_DEBUG | |
651 | if (tape->debug_level >= 2) | |
652 | @@ -5141,7 +5183,7 @@ | |
653 | * Note: | |
654 | * | |
655 | * MTBSF and MTBSFM are not supported when the tape doesn't | |
656 | - * supports spacing over filemarks in the reverse direction. | |
657 | + * support spacing over filemarks in the reverse direction. | |
658 | * In this case, MTFSFM is also usually not supported (it is | |
659 | * supported in the rare case in which we crossed the filemark | |
660 | * during our read-ahead pipelined operation mode). | |
661 | @@ -5211,6 +5253,8 @@ | |
662 | } | |
663 | switch (mt_op) { | |
664 | case MTWEOF: | |
665 | + if (tape->write_prot) | |
666 | + return -EACCES; | |
667 | idetape_discard_read_pipeline(drive, 1); | |
668 | for (i = 0; i < mt_count; i++) { | |
669 | retval = idetape_write_filemark(drive); | |
670 | @@ -5231,9 +5275,21 @@ | |
671 | return (idetape_queue_pc_tail(drive, &pc)); | |
672 | case MTUNLOAD: | |
673 | case MTOFFL: | |
674 | + /* | |
675 | + * If door is locked, attempt to unlock before | |
676 | + * attempting to eject. | |
677 | + */ | |
678 | + if (tape->door_locked) { | |
679 | + if (idetape_create_prevent_cmd(drive, &pc, 0)) | |
680 | + if (!idetape_queue_pc_tail(drive, &pc)) | |
681 | + tape->door_locked = DOOR_UNLOCKED; | |
682 | + } | |
683 | idetape_discard_read_pipeline(drive, 0); | |
684 | idetape_create_load_unload_cmd(drive, &pc,!IDETAPE_LU_LOAD_MASK); | |
685 | - return (idetape_queue_pc_tail(drive, &pc)); | |
686 | + retval = idetape_queue_pc_tail(drive, &pc); | |
687 | + if (!retval) | |
688 | + clear_bit(IDETAPE_MEDIUM_PRESENT, &tape->flags); | |
689 | + return retval; | |
690 | case MTNOP: | |
691 | idetape_discard_read_pipeline(drive, 0); | |
692 | return (idetape_flush_tape_buffers(drive)); | |
693 | @@ -5409,6 +5465,8 @@ | |
694 | mtget.mt_gstat |= GMT_EOD(0xffffffff); | |
695 | if (position <= OS_DATA_STARTFRAME1) | |
696 | mtget.mt_gstat |= GMT_BOT(0xffffffff); | |
697 | + } else if (tape->drv_write_prot) { | |
698 | + mtget.mt_gstat |= GMT_WR_PROT(0xffffffff); | |
699 | } | |
700 | if (copy_to_user((char *) arg,(char *) &mtget, sizeof(struct mtget))) | |
701 | return -EFAULT; | |
702 | @@ -5530,6 +5588,8 @@ | |
703 | return 1; | |
704 | } | |
705 | ||
706 | +static void idetape_get_blocksize_from_block_descriptor(ide_drive_t *drive); | |
707 | + | |
708 | /* | |
709 | * Our character device open function. | |
710 | */ | |
711 | @@ -5539,7 +5599,8 @@ | |
712 | ide_drive_t *drive; | |
713 | idetape_tape_t *tape; | |
714 | idetape_pc_t pc; | |
715 | - | |
716 | + int retval; | |
717 | + | |
718 | #if IDETAPE_DEBUG_LOG | |
719 | printk(KERN_INFO "ide-tape: Reached idetape_chrdev_open\n"); | |
720 | #endif /* IDETAPE_DEBUG_LOG */ | |
721 | @@ -5552,11 +5613,7 @@ | |
722 | ||
723 | if (test_and_set_bit(IDETAPE_BUSY, &tape->flags)) | |
724 | return -EBUSY; | |
725 | - if (!tape->onstream) { | |
726 | - idetape_read_position(drive); | |
727 | - if (!test_bit(IDETAPE_ADDRESS_VALID, &tape->flags)) | |
728 | - (void) idetape_rewind_tape(drive); | |
729 | - } else { | |
730 | + if (tape->onstream) { | |
731 | if (minor & 64) { | |
732 | tape->tape_block_size = tape->stage_size = 32768 + 512; | |
733 | tape->raw = 1; | |
734 | @@ -5566,16 +5623,42 @@ | |
735 | } | |
736 | idetape_onstream_mode_sense_tape_parameter_page(drive, tape->debug_level); | |
737 | } | |
738 | - if (idetape_wait_ready(drive, 60 * HZ)) { | |
739 | + retval = idetape_wait_ready(drive, 60 * HZ); | |
740 | + if (retval) { | |
741 | clear_bit(IDETAPE_BUSY, &tape->flags); | |
742 | printk(KERN_ERR "ide-tape: %s: drive not ready\n", tape->name); | |
743 | - return -EBUSY; | |
744 | + return retval; | |
745 | } | |
746 | - if (tape->onstream) | |
747 | - idetape_read_position(drive); | |
748 | + | |
749 | + idetape_read_position(drive); | |
750 | + if (!test_bit(IDETAPE_ADDRESS_VALID, &tape->flags)) | |
751 | + (void)idetape_rewind_tape(drive); | |
752 | + | |
753 | if (tape->chrdev_direction != idetape_direction_read) | |
754 | clear_bit(IDETAPE_PIPELINE_ERROR, &tape->flags); | |
755 | ||
756 | + /* Read block size and write protect status from drive. */ | |
757 | + idetape_get_blocksize_from_block_descriptor(drive); | |
758 | + | |
759 | + /* Set write protect flag if device is opened as read-only. */ | |
760 | + if ((filp->f_flags & O_ACCMODE) == O_RDONLY) | |
761 | + tape->write_prot = 1; | |
762 | + else | |
763 | + tape->write_prot = tape->drv_write_prot; | |
764 | + | |
765 | + /* Make sure drive isn't write protected if user wants to write. */ | |
766 | + if (tape->write_prot) { | |
767 | + if ((filp->f_flags & O_ACCMODE) == O_WRONLY || | |
768 | + (filp->f_flags & O_ACCMODE) == O_RDWR) { | |
769 | + clear_bit(IDETAPE_BUSY, &tape->flags); | |
770 | + return -EROFS; | |
771 | + } | |
772 | + } | |
773 | + | |
774 | + /* | |
775 | + * Lock the tape drive door so user can't eject. | |
776 | + * Analyze headers for OnStream drives. | |
777 | + */ | |
778 | if (tape->chrdev_direction == idetape_direction_none) { | |
779 | if (idetape_create_prevent_cmd(drive, &pc, 1)) { | |
780 | if (!idetape_queue_pc_tail(drive, &pc)) { | |
781 | @@ -5638,7 +5721,7 @@ | |
782 | __idetape_kfree_stage(tape->cache_stage); | |
783 | tape->cache_stage = NULL; | |
784 | } | |
785 | - if (minor < 128) | |
786 | + if (minor < 128 && test_bit(IDETAPE_MEDIUM_PRESENT, &tape->flags)) | |
787 | (void) idetape_rewind_tape(drive); | |
788 | if (tape->chrdev_direction == idetape_direction_none) { | |
789 | if (tape->door_locked == DOOR_LOCKED) { | |
790 | @@ -6059,6 +6142,8 @@ | |
791 | header = (idetape_mode_parameter_header_t *) pc.buffer; | |
792 | block_descrp = (idetape_parameter_block_descriptor_t *) (pc.buffer + sizeof(idetape_mode_parameter_header_t)); | |
793 | tape->tape_block_size =( block_descrp->length[0]<<16) + (block_descrp->length[1]<<8) + block_descrp->length[2]; | |
794 | + tape->drv_write_prot = (header->dsp & 0x80) >> 7; | |
795 | + | |
796 | #if IDETAPE_DEBUG_INFO | |
797 | printk(KERN_INFO "ide-tape: Adjusted block size - %d\n", tape->tape_block_size); | |
798 | #endif /* IDETAPE_DEBUG_INFO */ | |
799 | @@ -6139,6 +6224,9 @@ | |
800 | } | |
801 | } | |
802 | #endif /* CONFIG_BLK_DEV_IDEPCI */ | |
803 | + /* Seagate Travan drives do not support DSC overlap. */ | |
804 | + if (strstr(drive->id->model, "Seagate STT3401")) | |
805 | + drive->dsc_overlap = 0; | |
806 | tape->drive = drive; | |
807 | tape->minor = minor; | |
808 | tape->name[0] = 'h'; | |
809 | diff -uNr -X exclude linux-2.6.0-test11/drivers/ide/pci/cmd640.c linux/drivers/ide/pci/cmd640.c | |
810 | --- linux-2.6.0-test11/drivers/ide/pci/cmd640.c 2003-12-08 00:29:13.000000000 +0100 | |
811 | +++ linux/drivers/ide/pci/cmd640.c 2003-12-08 00:33:51.864083168 +0100 | |
812 | @@ -213,13 +213,13 @@ | |
813 | ||
814 | static void put_cmd640_reg_pci1 (u16 reg, u8 val) | |
815 | { | |
816 | - outb_p((reg & 0xfc) | cmd640_key, 0xcf8); | |
817 | + outl_p((reg & 0xfc) | cmd640_key, 0xcf8); | |
818 | outb_p(val, (reg & 3) | 0xcfc); | |
819 | } | |
820 | ||
821 | static u8 get_cmd640_reg_pci1 (u16 reg) | |
822 | { | |
823 | - outb_p((reg & 0xfc) | cmd640_key, 0xcf8); | |
824 | + outl_p((reg & 0xfc) | cmd640_key, 0xcf8); | |
825 | return inb_p((reg & 3) | 0xcfc); | |
826 | } | |
827 | ||
828 | diff -uNr -X exclude linux-2.6.0-test11/drivers/ide/pci/pdc202xx_new.c linux/drivers/ide/pci/pdc202xx_new.c | |
829 | --- linux-2.6.0-test11/drivers/ide/pci/pdc202xx_new.c 2003-12-08 00:29:12.000000000 +0100 | |
830 | +++ linux/drivers/ide/pci/pdc202xx_new.c 2003-12-08 00:33:52.996910952 +0100 | |
831 | @@ -36,60 +36,20 @@ | |
832 | ||
833 | #define PDC202_DEBUG_CABLE 0 | |
834 | ||
835 | -#if defined(DISPLAY_PDC202XX_TIMINGS) && defined(CONFIG_PROC_FS) | |
836 | -#include <linux/stat.h> | |
837 | -#include <linux/proc_fs.h> | |
838 | - | |
839 | -static u8 pdcnew_proc = 0; | |
840 | -#define PDC202_MAX_DEVS 5 | |
841 | -static struct pci_dev *pdc202_devs[PDC202_MAX_DEVS]; | |
842 | -static int n_pdc202_devs; | |
843 | - | |
844 | -static char * pdcnew_info(char *buf, struct pci_dev *dev) | |
845 | -{ | |
846 | - char *p = buf; | |
847 | - | |
848 | - p += sprintf(p, "\n "); | |
849 | - switch(dev->device) { | |
850 | - case PCI_DEVICE_ID_PROMISE_20277: | |
851 | - p += sprintf(p, "SBFastTrak 133 Lite"); break; | |
852 | - case PCI_DEVICE_ID_PROMISE_20276: | |
853 | - p += sprintf(p, "MBFastTrak 133 Lite"); break; | |
854 | - case PCI_DEVICE_ID_PROMISE_20275: | |
855 | - p += sprintf(p, "MBUltra133"); break; | |
856 | - case PCI_DEVICE_ID_PROMISE_20271: | |
857 | - p += sprintf(p, "FastTrak TX2000"); break; | |
858 | - case PCI_DEVICE_ID_PROMISE_20270: | |
859 | - p += sprintf(p, "FastTrak LP/TX2/TX4"); break; | |
860 | - case PCI_DEVICE_ID_PROMISE_20269: | |
861 | - p += sprintf(p, "Ultra133 TX2"); break; | |
862 | - case PCI_DEVICE_ID_PROMISE_20268: | |
863 | - p += sprintf(p, "Ultra100 TX2"); break; | |
864 | - default: | |
865 | - p += sprintf(p, "Ultra series"); break; | |
866 | - break; | |
867 | - } | |
868 | - p += sprintf(p, " Chipset.\n"); | |
869 | - return (char *)p; | |
870 | -} | |
871 | - | |
872 | -static int pdcnew_get_info (char *buffer, char **addr, off_t offset, int count) | |
873 | -{ | |
874 | - char *p = buffer; | |
875 | - int i, len; | |
876 | - | |
877 | - for (i = 0; i < n_pdc202_devs; i++) { | |
878 | - struct pci_dev *dev = pdc202_devs[i]; | |
879 | - p = pdcnew_info(buffer, dev); | |
880 | - } | |
881 | - /* p - buffer must be less than 4k! */ | |
882 | - len = (p - buffer) - offset; | |
883 | - *addr = buffer + offset; | |
884 | - | |
885 | - return len > count ? count : len; | |
886 | -} | |
887 | -#endif /* defined(DISPLAY_PDC202XX_TIMINGS) && defined(CONFIG_PROC_FS) */ | |
888 | +struct pdcnew_name { | |
889 | + u16 dev_id; | |
890 | + const char *name; | |
891 | +}; | |
892 | ||
893 | +static struct pdcnew_name __initdata pdcnew_names[] = { | |
894 | + { PCI_DEVICE_ID_PROMISE_20277, "SBFastTrak 133 Lite" }, | |
895 | + { PCI_DEVICE_ID_PROMISE_20276, "MBFastTrak 133 Lite" }, | |
896 | + { PCI_DEVICE_ID_PROMISE_20275, "MBUltra133", }, | |
897 | + { PCI_DEVICE_ID_PROMISE_20271, "FastTrak TX2000", }, | |
898 | + { PCI_DEVICE_ID_PROMISE_20270, "FastTrak LP/TX2/TX4", }, | |
899 | + { PCI_DEVICE_ID_PROMISE_20269, "Ultra133 TX2" }, | |
900 | + { PCI_DEVICE_ID_PROMISE_20268, "Ultra100 TX2" }, | |
901 | +}; | |
902 | ||
903 | static u8 pdcnew_ratemask (ide_drive_t *drive) | |
904 | { | |
905 | @@ -515,6 +475,15 @@ | |
906 | ||
907 | static unsigned int __init init_chipset_pdcnew (struct pci_dev *dev, const char *name) | |
908 | { | |
909 | + unsigned int i; | |
910 | + | |
911 | + for (i = 0; i < ARRAY_SIZE(pdcnew_names); i++) | |
912 | + if (pdcnew_names[i].dev_id == dev->device) { | |
913 | + printk(KERN_INFO "%s: %s on pci%s\n", name, | |
914 | + pdcnew_names[i].name, pci_name(dev)); | |
915 | + break; | |
916 | + } | |
917 | + | |
918 | if (dev->resource[PCI_ROM_RESOURCE].start) { | |
919 | pci_write_config_dword(dev, PCI_ROM_ADDRESS, | |
920 | dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); | |
921 | @@ -522,15 +491,6 @@ | |
922 | name, dev->resource[PCI_ROM_RESOURCE].start); | |
923 | } | |
924 | ||
925 | -#if defined(DISPLAY_PDC202XX_TIMINGS) && defined(CONFIG_PROC_FS) | |
926 | - pdc202_devs[n_pdc202_devs++] = dev; | |
927 | - | |
928 | - if (!pdcnew_proc) { | |
929 | - pdcnew_proc = 1; | |
930 | - ide_pci_register_host_proc(&pdcnew_procs[0]); | |
931 | - } | |
932 | -#endif /* DISPLAY_PDC202XX_TIMINGS && CONFIG_PROC_FS */ | |
933 | - | |
934 | return dev->irq; | |
935 | } | |
936 | ||
937 | diff -uNr -X exclude linux-2.6.0-test11/drivers/ide/pci/pdc202xx_new.h linux/drivers/ide/pci/pdc202xx_new.h | |
938 | --- linux-2.6.0-test11/drivers/ide/pci/pdc202xx_new.h 2003-12-08 00:29:12.000000000 +0100 | |
939 | +++ linux/drivers/ide/pci/pdc202xx_new.h 2003-12-08 00:33:52.997910800 +0100 | |
940 | @@ -5,8 +5,6 @@ | |
941 | #include <linux/pci.h> | |
942 | #include <linux/ide.h> | |
943 | ||
944 | -#define DISPLAY_PDC202XX_TIMINGS | |
945 | - | |
946 | #ifndef SPLIT_BYTE | |
947 | #define SPLIT_BYTE(B,H,L) ((H)=(B>>4), (L)=(B-((B>>4)<<4))) | |
948 | #endif | |
949 | @@ -162,27 +160,6 @@ | |
950 | set_2regs(0x13,(c)); \ | |
951 | } while(0) | |
952 | ||
953 | -#define DISPLAY_PDC202XX_TIMINGS | |
954 | - | |
955 | -#if defined(DISPLAY_PDC202XX_TIMINGS) && defined(CONFIG_PROC_FS) | |
956 | -#include <linux/stat.h> | |
957 | -#include <linux/proc_fs.h> | |
958 | - | |
959 | -static u8 pdcnew_proc; | |
960 | - | |
961 | -static int pdcnew_get_info(char *, char **, off_t, int); | |
962 | - | |
963 | -static ide_pci_host_proc_t pdcnew_procs[] __initdata = { | |
964 | - { | |
965 | - .name = "pdcnew", | |
966 | - .set = 1, | |
967 | - .get_info = pdcnew_get_info, | |
968 | - .parent = NULL, | |
969 | - }, | |
970 | -}; | |
971 | -#endif /* DISPLAY_PDC202XX_TIMINGS && CONFIG_PROC_FS */ | |
972 | - | |
973 | - | |
974 | static void init_setup_pdcnew(struct pci_dev *, ide_pci_device_t *); | |
975 | static void init_setup_pdc20270(struct pci_dev *, ide_pci_device_t *); | |
976 | static void init_setup_pdc20276(struct pci_dev *dev, ide_pci_device_t *d); | |
977 | diff -uNr -X exclude linux-2.6.0-test11/drivers/ide/pci/pdc202xx_old.c linux/drivers/ide/pci/pdc202xx_old.c | |
978 | --- linux-2.6.0-test11/drivers/ide/pci/pdc202xx_old.c 2003-12-08 00:29:12.000000000 +0100 | |
979 | +++ linux/drivers/ide/pci/pdc202xx_old.c 2003-12-08 00:33:52.369006408 +0100 | |
980 | @@ -361,16 +361,38 @@ | |
981 | return ((u8)(CIS & mask)); | |
982 | } | |
983 | ||
984 | +/* | |
985 | + * Set the control register to use the 66MHz system | |
986 | + * clock for UDMA 3/4/5 mode operation when necessary. | |
987 | + * | |
988 | + * It may also be possible to leave the 66MHz clock on | |
989 | + * and readjust the timing parameters. | |
990 | + */ | |
991 | +static void pdc_old_enable_66MHz_clock(ide_hwif_t *hwif) | |
992 | +{ | |
993 | + unsigned long clock_reg = hwif->dma_master + 0x11; | |
994 | + u8 clock = hwif->INB(clock_reg); | |
995 | + | |
996 | + hwif->OUTB(clock | (hwif->channel ? 0x08 : 0x02), clock_reg); | |
997 | +} | |
998 | + | |
999 | +static void pdc_old_disable_66MHz_clock(ide_hwif_t *hwif) | |
1000 | +{ | |
1001 | + unsigned long clock_reg = hwif->dma_master + 0x11; | |
1002 | + u8 clock = hwif->INB(clock_reg); | |
1003 | + | |
1004 | + hwif->OUTB(clock & ~(hwif->channel ? 0x08 : 0x02), clock_reg); | |
1005 | +} | |
1006 | + | |
1007 | static int config_chipset_for_dma (ide_drive_t *drive) | |
1008 | { | |
1009 | struct hd_driveid *id = drive->id; | |
1010 | ide_hwif_t *hwif = HWIF(drive); | |
1011 | struct pci_dev *dev = hwif->pci_dev; | |
1012 | u32 drive_conf = 0; | |
1013 | - u8 mask = hwif->channel ? 0x08 : 0x02; | |
1014 | u8 drive_pci = 0x60 + (drive->dn << 2); | |
1015 | u8 test1 = 0, test2 = 0, speed = -1; | |
1016 | - u8 AP = 0, CLKSPD = 0, cable = 0; | |
1017 | + u8 AP = 0, cable = 0; | |
1018 | ||
1019 | u8 ultra_66 = ((id->dma_ultra & 0x0010) || | |
1020 | (id->dma_ultra & 0x0008)) ? 1 : 0; | |
1021 | @@ -394,21 +416,6 @@ | |
1022 | BUG(); | |
1023 | } | |
1024 | ||
1025 | - CLKSPD = hwif->INB(hwif->dma_master + 0x11); | |
1026 | - | |
1027 | - /* | |
1028 | - * Set the control register to use the 66Mhz system | |
1029 | - * clock for UDMA 3/4 mode operation. If one drive on | |
1030 | - * a channel is U66 capable but the other isn't we | |
1031 | - * fall back to U33 mode. The BIOS INT 13 hooks turn | |
1032 | - * the clock on then off for each read/write issued. I don't | |
1033 | - * do that here because it would require modifying the | |
1034 | - * kernel, separating the fop routines from the kernel or | |
1035 | - * somehow hooking the fops calls. It may also be possible to | |
1036 | - * leave the 66Mhz clock on and readjust the timing | |
1037 | - * parameters. | |
1038 | - */ | |
1039 | - | |
1040 | if ((ultra_66) && (cable)) { | |
1041 | #ifdef DEBUG | |
1042 | printk(KERN_DEBUG "ULTRA 66/100/133: %s channel of Ultra 66/100/133 " | |
1043 | @@ -416,29 +423,12 @@ | |
1044 | hwif->channel ? "Secondary" : "Primary"); | |
1045 | printk(KERN_DEBUG " Switching to Ultra33 mode.\n"); | |
1046 | #endif /* DEBUG */ | |
1047 | - /* Primary : zero out second bit */ | |
1048 | - /* Secondary : zero out fourth bit */ | |
1049 | - hwif->OUTB(CLKSPD & ~mask, (hwif->dma_master + 0x11)); | |
1050 | printk(KERN_WARNING "Warning: %s channel requires an 80-pin cable for operation.\n", hwif->channel ? "Secondary":"Primary"); | |
1051 | printk(KERN_WARNING "%s reduced to Ultra33 mode.\n", drive->name); | |
1052 | - } else { | |
1053 | - if (ultra_66) { | |
1054 | - /* | |
1055 | - * check to make sure drive on same channel | |
1056 | - * is u66 capable | |
1057 | - */ | |
1058 | - if (hwif->drives[!(drive->dn%2)].id) { | |
1059 | - if (hwif->drives[!(drive->dn%2)].id->dma_ultra & 0x0078) { | |
1060 | - hwif->OUTB(CLKSPD | mask, (hwif->dma_master + 0x11)); | |
1061 | - } else { | |
1062 | - hwif->OUTB(CLKSPD & ~mask, (hwif->dma_master + 0x11)); | |
1063 | - } | |
1064 | - } else { /* udma4 drive by itself */ | |
1065 | - hwif->OUTB(CLKSPD | mask, (hwif->dma_master + 0x11)); | |
1066 | - } | |
1067 | - } | |
1068 | } | |
1069 | ||
1070 | + pdc_old_disable_66MHz_clock(drive->hwif); | |
1071 | + | |
1072 | drive_pci = 0x60 + (drive->dn << 2); | |
1073 | pci_read_config_dword(dev, drive_pci, &drive_conf); | |
1074 | if ((drive_conf != 0x004ff304) && (drive_conf != 0x004ff3c4)) | |
1075 | @@ -536,6 +526,8 @@ | |
1076 | ||
1077 | static int pdc202xx_old_ide_dma_begin(ide_drive_t *drive) | |
1078 | { | |
1079 | + if (drive->current_speed > XFER_UDMA_2) | |
1080 | + pdc_old_enable_66MHz_clock(drive->hwif); | |
1081 | if (drive->addressing == 1) { | |
1082 | struct request *rq = HWGROUP(drive)->rq; | |
1083 | ide_hwif_t *hwif = HWIF(drive); | |
1084 | @@ -569,6 +561,8 @@ | |
1085 | clock = hwif->INB(high_16 + 0x11); | |
1086 | hwif->OUTB(clock & ~(hwif->channel ? 0x08:0x02), high_16+0x11); | |
1087 | } | |
1088 | + if (drive->current_speed > XFER_UDMA_2) | |
1089 | + pdc_old_disable_66MHz_clock(drive->hwif); | |
1090 | return __ide_dma_end(drive); | |
1091 | } | |
1092 | ||
1093 | @@ -757,10 +751,7 @@ | |
1094 | ||
1095 | hwif->speedproc = &pdc202xx_tune_chipset; | |
1096 | ||
1097 | - if (!hwif->dma_base) { | |
1098 | - hwif->drives[0].autotune = hwif->drives[1].autotune = 1; | |
1099 | - return; | |
1100 | - } | |
1101 | + hwif->drives[0].autotune = hwif->drives[1].autotune = 1; | |
1102 | ||
1103 | hwif->ultra_mask = 0x3f; | |
1104 | hwif->mwdma_mask = 0x07; | |
1105 | diff -uNr -X exclude linux-2.6.0-test11/drivers/ide/pci/siimage.c linux/drivers/ide/pci/siimage.c | |
1106 | --- linux-2.6.0-test11/drivers/ide/pci/siimage.c 2003-12-08 00:29:13.000000000 +0100 | |
1107 | +++ linux/drivers/ide/pci/siimage.c 2003-12-08 00:33:51.712106272 +0100 | |
1108 | @@ -1,5 +1,5 @@ | |
1109 | /* | |
1110 | - * linux/drivers/ide/pci/siimage.c Version 1.06 June 11, 2003 | |
1111 | + * linux/drivers/ide/pci/siimage.c Version 1.09 Dec 7, 2003 | |
1112 | * | |
1113 | * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> | |
1114 | * Copyright (C) 2003 Red Hat <alan@redhat.com> | |
1115 | @@ -56,6 +56,7 @@ | |
1116 | { | |
1117 | case PCI_DEVICE_ID_SII_3112: | |
1118 | case PCI_DEVICE_ID_SII_1210SA: | |
1119 | + case PCI_DEVICE_ID_SII_3114: | |
1120 | return 1; | |
1121 | case PCI_DEVICE_ID_SII_680: | |
1122 | return 0; | |
1123 | @@ -266,7 +267,7 @@ | |
1124 | static void siimage_tuneproc (ide_drive_t *drive, byte mode_wanted) | |
1125 | { | |
1126 | ide_hwif_t *hwif = HWIF(drive); | |
1127 | - u32 speedt = 0; | |
1128 | + u16 speedt = 0; | |
1129 | u16 speedp = 0; | |
1130 | unsigned long addr = siimage_seldev(drive, 0x04); | |
1131 | unsigned long tfaddr = siimage_selreg(hwif, 0x02); | |
1132 | @@ -1047,6 +1048,27 @@ | |
1133 | hwif->mmio = 2; | |
1134 | } | |
1135 | ||
1136 | +static int is_dev_seagate_sata(ide_drive_t *drive) | |
1137 | +{ | |
1138 | + const char *s = &drive->id->model[0]; | |
1139 | + unsigned len; | |
1140 | + | |
1141 | + if (!drive->present) | |
1142 | + return 0; | |
1143 | + | |
1144 | + len = strnlen(s, sizeof(drive->id->model)); | |
1145 | + | |
1146 | + if ((len > 4) && (!memcmp(s, "ST", 2))) { | |
1147 | + if ((!memcmp(s + len - 2, "AS", 2)) || | |
1148 | + (!memcmp(s + len - 3, "ASL", 3))) { | |
1149 | + printk(KERN_INFO "%s: applying pessimistic Seagate " | |
1150 | + "errata fix\n", drive->name); | |
1151 | + return 1; | |
1152 | + } | |
1153 | + } | |
1154 | + return 0; | |
1155 | +} | |
1156 | + | |
1157 | /** | |
1158 | * init_iops_siimage - set up iops | |
1159 | * @hwif: interface to set up | |
1160 | @@ -1068,7 +1090,7 @@ | |
1161 | hwif->hwif_data = 0; | |
1162 | ||
1163 | hwif->rqsize = 128; | |
1164 | - if (is_sata(hwif)) | |
1165 | + if (is_sata(hwif) && is_dev_seagate_sata(&hwif->drives[0])) | |
1166 | hwif->rqsize = 15; | |
1167 | ||
1168 | if (pci_get_drvdata(dev) == NULL) | |
1169 | @@ -1179,6 +1201,7 @@ | |
1170 | { PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | |
1171 | { PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, | |
1172 | { PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_1210SA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2}, | |
1173 | + { PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_3114, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3}, | |
1174 | { 0, }, | |
1175 | }; | |
1176 | ||
1177 | diff -uNr -X exclude linux-2.6.0-test11/drivers/ide/pci/siimage.h linux/drivers/ide/pci/siimage.h | |
1178 | --- linux-2.6.0-test11/drivers/ide/pci/siimage.h 2003-12-08 00:29:13.000000000 +0100 | |
1179 | +++ linux/drivers/ide/pci/siimage.h 2003-12-08 00:33:51.713106120 +0100 | |
1180 | @@ -82,6 +82,16 @@ | |
1181 | .enablebits = {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, | |
1182 | .bootable = ON_BOARD, | |
1183 | .extra = 0, | |
1184 | + },{ /* 3 */ | |
1185 | + .vendor = PCI_VENDOR_ID_CMD, | |
1186 | + .device = PCI_DEVICE_ID_SII_3114, | |
1187 | + .name = "SiI3114 Serial ATA", | |
1188 | + .init_chipset = init_chipset_siimage, | |
1189 | + .init_iops = init_iops_siimage, | |
1190 | + .init_hwif = init_hwif_siimage, | |
1191 | + .channels = 2, | |
1192 | + .autodma = AUTODMA, | |
1193 | + .bootable = ON_BOARD, | |
1194 | },{ | |
1195 | .vendor = 0, | |
1196 | .device = 0, | |
1197 | diff -uNr -X exclude linux-2.6.0-test11/include/linux/blkdev.h linux/include/linux/blkdev.h | |
1198 | --- linux-2.6.0-test11/include/linux/blkdev.h 2003-12-08 00:29:13.000000000 +0100 | |
1199 | +++ linux/include/linux/blkdev.h 2003-12-08 00:33:51.208182880 +0100 | |
1200 | @@ -193,11 +193,6 @@ | |
1201 | __REQ_PM_SUSPEND, /* suspend request */ | |
1202 | __REQ_PM_RESUME, /* resume request */ | |
1203 | __REQ_PM_SHUTDOWN, /* shutdown request */ | |
1204 | - __REQ_IDETAPE_PC1, /* packet command (first stage) */ | |
1205 | - __REQ_IDETAPE_PC2, /* packet command (second stage) */ | |
1206 | - __REQ_IDETAPE_READ, | |
1207 | - __REQ_IDETAPE_WRITE, | |
1208 | - __REQ_IDETAPE_READ_BUFFER, | |
1209 | __REQ_NR_BITS, /* stops here */ | |
1210 | }; | |
1211 | ||
1212 | @@ -223,11 +218,6 @@ | |
1213 | #define REQ_PM_SUSPEND (1 << __REQ_PM_SUSPEND) | |
1214 | #define REQ_PM_RESUME (1 << __REQ_PM_RESUME) | |
1215 | #define REQ_PM_SHUTDOWN (1 << __REQ_PM_SHUTDOWN) | |
1216 | -#define REQ_IDETAPE_PC1 (1 << __REQ_IDETAPE_PC1) | |
1217 | -#define REQ_IDETAPE_PC2 (1 << __REQ_IDETAPE_PC2) | |
1218 | -#define REQ_IDETAPE_READ (1 << __REQ_IDETAPE_READ) | |
1219 | -#define REQ_IDETAPE_WRITE (1 << __REQ_IDETAPE_WRITE) | |
1220 | -#define REQ_IDETAPE_READ_BUFFER (1 << __REQ_IDETAPE_READ_BUFFER) | |
1221 | ||
1222 | /* | |
1223 | * State information carried for REQ_PM_SUSPEND and REQ_PM_RESUME | |
1224 | diff -uNr -X exclude linux-2.6.0-test11/include/linux/ide.h linux/include/linux/ide.h | |
1225 | --- linux-2.6.0-test11/include/linux/ide.h 2003-12-08 00:29:12.000000000 +0100 | |
1226 | +++ linux/include/linux/ide.h 2003-12-08 00:33:52.836935272 +0100 | |
1227 | @@ -51,9 +51,6 @@ | |
1228 | #ifndef SUPPORT_VLB_SYNC /* 1 to support weird 32-bit chips */ | |
1229 | #define SUPPORT_VLB_SYNC 1 /* 0 to reduce kernel size */ | |
1230 | #endif | |
1231 | -#ifndef DISK_RECOVERY_TIME /* off=0; on=access_delay_time */ | |
1232 | -#define DISK_RECOVERY_TIME 0 /* for hardware that needs it */ | |
1233 | -#endif | |
1234 | #ifndef OK_TO_RESET_CONTROLLER /* 1 needed for good error recovery */ | |
1235 | #define OK_TO_RESET_CONTROLLER 1 /* 0 for use with AH2372A/B interface */ | |
1236 | #endif | |
1237 | @@ -999,10 +996,6 @@ | |
1238 | unsigned dma_extra; /* extra addr for dma ports */ | |
1239 | unsigned long config_data; /* for use by chipset-specific code */ | |
1240 | unsigned long select_data; /* for use by chipset-specific code */ | |
1241 | -#if (DISK_RECOVERY_TIME > 0) | |
1242 | - unsigned long last_time; /* time when previous rq was done */ | |
1243 | -#endif | |
1244 | - | |
1245 | ||
1246 | unsigned noprobe : 1; /* don't probe for this interface */ | |
1247 | unsigned present : 1; /* this interface exists */ | |
1248 | diff -uNr -X exclude linux-2.6.0-test11/include/linux/pci_ids.h linux/include/linux/pci_ids.h | |
1249 | --- linux-2.6.0-test11/include/linux/pci_ids.h 2003-12-08 00:29:13.000000000 +0100 | |
1250 | +++ linux/include/linux/pci_ids.h 2003-12-08 00:33:51.715105816 +0100 | |
1251 | @@ -882,6 +882,7 @@ | |
1252 | ||
1253 | #define PCI_DEVICE_ID_SII_680 0x0680 | |
1254 | #define PCI_DEVICE_ID_SII_3112 0x3112 | |
1255 | +#define PCI_DEVICE_ID_SII_3114 0x3114 | |
1256 | #define PCI_DEVICE_ID_SII_1210SA 0x0240 | |
1257 | ||
1258 | #define PCI_VENDOR_ID_VISION 0x1098 |