diff options
51 files changed, 924 insertions, 1233 deletions
diff --git a/Documentation/infiniband/ipoib.txt b/Documentation/infiniband/ipoib.txt index 864ff3283780..6d40f00b358c 100644 --- a/Documentation/infiniband/ipoib.txt +++ b/Documentation/infiniband/ipoib.txt | |||
@@ -24,6 +24,49 @@ Partitions and P_Keys | |||
24 | The P_Key for any interface is given by the "pkey" file, and the | 24 | The P_Key for any interface is given by the "pkey" file, and the |
25 | main interface for a subinterface is in "parent." | 25 | main interface for a subinterface is in "parent." |
26 | 26 | ||
27 | Datagram vs Connected modes | ||
28 | |||
29 | The IPoIB driver supports two modes of operation: datagram and | ||
30 | connected. The mode is set and read through an interface's | ||
31 | /sys/class/net/<intf name>/mode file. | ||
32 | |||
33 | In datagram mode, the IB UD (Unreliable Datagram) transport is used | ||
34 | and so the interface MTU has is equal to the IB L2 MTU minus the | ||
35 | IPoIB encapsulation header (4 bytes). For example, in a typical IB | ||
36 | fabric with a 2K MTU, the IPoIB MTU will be 2048 - 4 = 2044 bytes. | ||
37 | |||
38 | In connected mode, the IB RC (Reliable Connected) transport is used. | ||
39 | Connected mode is to takes advantage of the connected nature of the | ||
40 | IB transport and allows an MTU up to the maximal IP packet size of | ||
41 | 64K, which reduces the number of IP packets needed for handling | ||
42 | large UDP datagrams, TCP segments, etc and increases the performance | ||
43 | for large messages. | ||
44 | |||
45 | In connected mode, the interface's UD QP is still used for multicast | ||
46 | and communication with peers that don't support connected mode. In | ||
47 | this case, RX emulation of ICMP PMTU packets is used to cause the | ||
48 | networking stack to use the smaller UD MTU for these neighbours. | ||
49 | |||
50 | Stateless offloads | ||
51 | |||
52 | If the IB HW supports IPoIB stateless offloads, IPoIB advertises | ||
53 | TCP/IP checksum and/or Large Send (LSO) offloading capability to the | ||
54 | network stack. | ||
55 | |||
56 | Large Receive (LRO) offloading is also implemented and may be turned | ||
57 | on/off using ethtool calls. Currently LRO is supported only for | ||
58 | checksum offload capable devices. | ||
59 | |||
60 | Stateless offloads are supported only in datagram mode. | ||
61 | |||
62 | Interrupt moderation | ||
63 | |||
64 | If the underlying IB device supports CQ event moderation, one can | ||
65 | use ethtool to set interrupt mitigation parameters and thus reduce | ||
66 | the overhead incurred by handling interrupts. The main code path of | ||
67 | IPoIB doesn't use events for TX completion signaling so only RX | ||
68 | moderation is supported. | ||
69 | |||
27 | Debugging Information | 70 | Debugging Information |
28 | 71 | ||
29 | By compiling the IPoIB driver with CONFIG_INFINIBAND_IPOIB_DEBUG set | 72 | By compiling the IPoIB driver with CONFIG_INFINIBAND_IPOIB_DEBUG set |
@@ -55,3 +98,5 @@ References | |||
55 | http://ietf.org/rfc/rfc4391.txt | 98 | http://ietf.org/rfc/rfc4391.txt |
56 | IP over InfiniBand (IPoIB) Architecture (RFC 4392) | 99 | IP over InfiniBand (IPoIB) Architecture (RFC 4392) |
57 | http://ietf.org/rfc/rfc4392.txt | 100 | http://ietf.org/rfc/rfc4392.txt |
101 | IP over InfiniBand: Connected Mode (RFC 4755) | ||
102 | http://ietf.org/rfc/rfc4755.txt | ||
diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h index 81937a5dc77c..2d81af3974a0 100644 --- a/arch/x86/include/asm/fixmap.h +++ b/arch/x86/include/asm/fixmap.h | |||
@@ -151,11 +151,11 @@ extern pte_t *pkmap_page_table; | |||
151 | 151 | ||
152 | void __native_set_fixmap(enum fixed_addresses idx, pte_t pte); | 152 | void __native_set_fixmap(enum fixed_addresses idx, pte_t pte); |
153 | void native_set_fixmap(enum fixed_addresses idx, | 153 | void native_set_fixmap(enum fixed_addresses idx, |
154 | unsigned long phys, pgprot_t flags); | 154 | phys_addr_t phys, pgprot_t flags); |
155 | 155 | ||
156 | #ifndef CONFIG_PARAVIRT | 156 | #ifndef CONFIG_PARAVIRT |
157 | static inline void __set_fixmap(enum fixed_addresses idx, | 157 | static inline void __set_fixmap(enum fixed_addresses idx, |
158 | unsigned long phys, pgprot_t flags) | 158 | phys_addr_t phys, pgprot_t flags) |
159 | { | 159 | { |
160 | native_set_fixmap(idx, phys, flags); | 160 | native_set_fixmap(idx, phys, flags); |
161 | } | 161 | } |
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index 7727aa8b7dda..378e3691c08c 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h | |||
@@ -347,7 +347,7 @@ struct pv_mmu_ops { | |||
347 | /* Sometimes the physical address is a pfn, and sometimes its | 347 | /* Sometimes the physical address is a pfn, and sometimes its |
348 | an mfn. We can tell which is which from the index. */ | 348 | an mfn. We can tell which is which from the index. */ |
349 | void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx, | 349 | void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx, |
350 | unsigned long phys, pgprot_t flags); | 350 | phys_addr_t phys, pgprot_t flags); |
351 | }; | 351 | }; |
352 | 352 | ||
353 | struct raw_spinlock; | 353 | struct raw_spinlock; |
@@ -1432,7 +1432,7 @@ static inline void arch_leave_lazy_mmu_mode(void) | |||
1432 | void arch_flush_lazy_mmu_mode(void); | 1432 | void arch_flush_lazy_mmu_mode(void); |
1433 | 1433 | ||
1434 | static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx, | 1434 | static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx, |
1435 | unsigned long phys, pgprot_t flags) | 1435 | phys_addr_t phys, pgprot_t flags) |
1436 | { | 1436 | { |
1437 | pv_mmu_ops.set_fixmap(idx, phys, flags); | 1437 | pv_mmu_ops.set_fixmap(idx, phys, flags); |
1438 | } | 1438 | } |
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index 5b7c7c8464fe..7aa03a5389f5 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c | |||
@@ -345,7 +345,8 @@ void __native_set_fixmap(enum fixed_addresses idx, pte_t pte) | |||
345 | fixmaps_set++; | 345 | fixmaps_set++; |
346 | } | 346 | } |
347 | 347 | ||
348 | void native_set_fixmap(enum fixed_addresses idx, unsigned long phys, pgprot_t flags) | 348 | void native_set_fixmap(enum fixed_addresses idx, phys_addr_t phys, |
349 | pgprot_t flags) | ||
349 | { | 350 | { |
350 | __native_set_fixmap(idx, pfn_pte(phys >> PAGE_SHIFT, flags)); | 351 | __native_set_fixmap(idx, pfn_pte(phys >> PAGE_SHIFT, flags)); |
351 | } | 352 | } |
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index db3802fb7b84..2a81838a9ab7 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
@@ -1750,7 +1750,7 @@ __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, | |||
1750 | } | 1750 | } |
1751 | #endif /* CONFIG_X86_64 */ | 1751 | #endif /* CONFIG_X86_64 */ |
1752 | 1752 | ||
1753 | static void xen_set_fixmap(unsigned idx, unsigned long phys, pgprot_t prot) | 1753 | static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot) |
1754 | { | 1754 | { |
1755 | pte_t pte; | 1755 | pte_t pte; |
1756 | 1756 | ||
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index 6cccdc3f5220..4aecf5dc6a93 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c | |||
@@ -563,7 +563,7 @@ static void ace_fsm_dostate(struct ace_device *ace) | |||
563 | case ACE_FSM_STATE_IDENTIFY_PREPARE: | 563 | case ACE_FSM_STATE_IDENTIFY_PREPARE: |
564 | /* Send identify command */ | 564 | /* Send identify command */ |
565 | ace->fsm_task = ACE_TASK_IDENTIFY; | 565 | ace->fsm_task = ACE_TASK_IDENTIFY; |
566 | ace->data_ptr = &ace->cf_id; | 566 | ace->data_ptr = ace->cf_id; |
567 | ace->data_count = ACE_BUF_PER_SECTOR; | 567 | ace->data_count = ACE_BUF_PER_SECTOR; |
568 | ace_out(ace, ACE_SECCNTCMD, ACE_SECCNTCMD_IDENTIFY); | 568 | ace_out(ace, ACE_SECCNTCMD, ACE_SECCNTCMD_IDENTIFY); |
569 | 569 | ||
@@ -608,8 +608,8 @@ static void ace_fsm_dostate(struct ace_device *ace) | |||
608 | break; | 608 | break; |
609 | 609 | ||
610 | case ACE_FSM_STATE_IDENTIFY_COMPLETE: | 610 | case ACE_FSM_STATE_IDENTIFY_COMPLETE: |
611 | ace_fix_driveid(&ace->cf_id[0]); | 611 | ace_fix_driveid(ace->cf_id); |
612 | ace_dump_mem(&ace->cf_id, 512); /* Debug: Dump out disk ID */ | 612 | ace_dump_mem(ace->cf_id, 512); /* Debug: Dump out disk ID */ |
613 | 613 | ||
614 | if (ace->data_result) { | 614 | if (ace->data_result) { |
615 | /* Error occured, disable the disk */ | 615 | /* Error occured, disable the disk */ |
@@ -622,9 +622,9 @@ static void ace_fsm_dostate(struct ace_device *ace) | |||
622 | 622 | ||
623 | /* Record disk parameters */ | 623 | /* Record disk parameters */ |
624 | set_capacity(ace->gd, | 624 | set_capacity(ace->gd, |
625 | ata_id_u32(&ace->cf_id, ATA_ID_LBA_CAPACITY)); | 625 | ata_id_u32(ace->cf_id, ATA_ID_LBA_CAPACITY)); |
626 | dev_info(ace->dev, "capacity: %i sectors\n", | 626 | dev_info(ace->dev, "capacity: %i sectors\n", |
627 | ata_id_u32(&ace->cf_id, ATA_ID_LBA_CAPACITY)); | 627 | ata_id_u32(ace->cf_id, ATA_ID_LBA_CAPACITY)); |
628 | } | 628 | } |
629 | 629 | ||
630 | /* We're done, drop to IDLE state and notify waiters */ | 630 | /* We're done, drop to IDLE state and notify waiters */ |
@@ -923,7 +923,7 @@ static int ace_release(struct gendisk *disk, fmode_t mode) | |||
923 | static int ace_getgeo(struct block_device *bdev, struct hd_geometry *geo) | 923 | static int ace_getgeo(struct block_device *bdev, struct hd_geometry *geo) |
924 | { | 924 | { |
925 | struct ace_device *ace = bdev->bd_disk->private_data; | 925 | struct ace_device *ace = bdev->bd_disk->private_data; |
926 | u16 *cf_id = &ace->cf_id[0]; | 926 | u16 *cf_id = ace->cf_id; |
927 | 927 | ||
928 | dev_dbg(ace->dev, "ace_getgeo()\n"); | 928 | dev_dbg(ace->dev, "ace_getgeo()\n"); |
929 | 929 | ||
diff --git a/drivers/ide/at91_ide.c b/drivers/ide/at91_ide.c index 8eda552326e9..403d0e4265db 100644 --- a/drivers/ide/at91_ide.c +++ b/drivers/ide/at91_ide.c | |||
@@ -20,7 +20,6 @@ | |||
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/version.h> | ||
24 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
25 | #include <linux/module.h> | 24 | #include <linux/module.h> |
26 | #include <linux/clk.h> | 25 | #include <linux/clk.h> |
@@ -175,90 +174,6 @@ static void at91_ide_output_data(ide_drive_t *drive, struct ide_cmd *cmd, | |||
175 | leave_16bit(chipselect, mode); | 174 | leave_16bit(chipselect, mode); |
176 | } | 175 | } |
177 | 176 | ||
178 | static u8 ide_mm_inb(unsigned long port) | ||
179 | { | ||
180 | return readb((void __iomem *) port); | ||
181 | } | ||
182 | |||
183 | static void ide_mm_outb(u8 value, unsigned long port) | ||
184 | { | ||
185 | writeb(value, (void __iomem *) port); | ||
186 | } | ||
187 | |||
188 | static void at91_ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) | ||
189 | { | ||
190 | ide_hwif_t *hwif = drive->hwif; | ||
191 | struct ide_io_ports *io_ports = &hwif->io_ports; | ||
192 | struct ide_taskfile *tf = &cmd->tf; | ||
193 | u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; | ||
194 | |||
195 | if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) | ||
196 | HIHI = 0xFF; | ||
197 | |||
198 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) | ||
199 | ide_mm_outb(tf->hob_feature, io_ports->feature_addr); | ||
200 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) | ||
201 | ide_mm_outb(tf->hob_nsect, io_ports->nsect_addr); | ||
202 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) | ||
203 | ide_mm_outb(tf->hob_lbal, io_ports->lbal_addr); | ||
204 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) | ||
205 | ide_mm_outb(tf->hob_lbam, io_ports->lbam_addr); | ||
206 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) | ||
207 | ide_mm_outb(tf->hob_lbah, io_ports->lbah_addr); | ||
208 | |||
209 | if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) | ||
210 | ide_mm_outb(tf->feature, io_ports->feature_addr); | ||
211 | if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) | ||
212 | ide_mm_outb(tf->nsect, io_ports->nsect_addr); | ||
213 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) | ||
214 | ide_mm_outb(tf->lbal, io_ports->lbal_addr); | ||
215 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) | ||
216 | ide_mm_outb(tf->lbam, io_ports->lbam_addr); | ||
217 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) | ||
218 | ide_mm_outb(tf->lbah, io_ports->lbah_addr); | ||
219 | |||
220 | if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) | ||
221 | ide_mm_outb((tf->device & HIHI) | drive->select, io_ports->device_addr); | ||
222 | } | ||
223 | |||
224 | static void at91_ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) | ||
225 | { | ||
226 | ide_hwif_t *hwif = drive->hwif; | ||
227 | struct ide_io_ports *io_ports = &hwif->io_ports; | ||
228 | struct ide_taskfile *tf = &cmd->tf; | ||
229 | |||
230 | /* be sure we're looking at the low order bits */ | ||
231 | ide_mm_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); | ||
232 | |||
233 | if (cmd->tf_flags & IDE_TFLAG_IN_ERROR) | ||
234 | tf->error = ide_mm_inb(io_ports->feature_addr); | ||
235 | if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) | ||
236 | tf->nsect = ide_mm_inb(io_ports->nsect_addr); | ||
237 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) | ||
238 | tf->lbal = ide_mm_inb(io_ports->lbal_addr); | ||
239 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) | ||
240 | tf->lbam = ide_mm_inb(io_ports->lbam_addr); | ||
241 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) | ||
242 | tf->lbah = ide_mm_inb(io_ports->lbah_addr); | ||
243 | if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) | ||
244 | tf->device = ide_mm_inb(io_ports->device_addr); | ||
245 | |||
246 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { | ||
247 | ide_mm_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr); | ||
248 | |||
249 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_ERROR) | ||
250 | tf->hob_error = ide_mm_inb(io_ports->feature_addr); | ||
251 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) | ||
252 | tf->hob_nsect = ide_mm_inb(io_ports->nsect_addr); | ||
253 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) | ||
254 | tf->hob_lbal = ide_mm_inb(io_ports->lbal_addr); | ||
255 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) | ||
256 | tf->hob_lbam = ide_mm_inb(io_ports->lbam_addr); | ||
257 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) | ||
258 | tf->hob_lbah = ide_mm_inb(io_ports->lbah_addr); | ||
259 | } | ||
260 | } | ||
261 | |||
262 | static void at91_ide_set_pio_mode(ide_drive_t *drive, const u8 pio) | 177 | static void at91_ide_set_pio_mode(ide_drive_t *drive, const u8 pio) |
263 | { | 178 | { |
264 | struct ide_timing *timing; | 179 | struct ide_timing *timing; |
@@ -284,8 +199,8 @@ static const struct ide_tp_ops at91_ide_tp_ops = { | |||
284 | .write_devctl = ide_write_devctl, | 199 | .write_devctl = ide_write_devctl, |
285 | 200 | ||
286 | .dev_select = ide_dev_select, | 201 | .dev_select = ide_dev_select, |
287 | .tf_load = at91_ide_tf_load, | 202 | .tf_load = ide_tf_load, |
288 | .tf_read = at91_ide_tf_read, | 203 | .tf_read = ide_tf_read, |
289 | 204 | ||
290 | .input_data = at91_ide_input_data, | 205 | .input_data = at91_ide_input_data, |
291 | .output_data = at91_ide_output_data, | 206 | .output_data = at91_ide_output_data, |
@@ -300,7 +215,7 @@ static const struct ide_port_info at91_ide_port_info __initdata = { | |||
300 | .tp_ops = &at91_ide_tp_ops, | 215 | .tp_ops = &at91_ide_tp_ops, |
301 | .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA | IDE_HFLAG_SINGLE | | 216 | .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA | IDE_HFLAG_SINGLE | |
302 | IDE_HFLAG_NO_IO_32BIT | IDE_HFLAG_UNMASK_IRQS, | 217 | IDE_HFLAG_NO_IO_32BIT | IDE_HFLAG_UNMASK_IRQS, |
303 | .pio_mask = ATA_PIO5, | 218 | .pio_mask = ATA_PIO6, |
304 | }; | 219 | }; |
305 | 220 | ||
306 | /* | 221 | /* |
diff --git a/drivers/ide/falconide.c b/drivers/ide/falconide.c index afa2af9a362b..0e2df6755ec9 100644 --- a/drivers/ide/falconide.c +++ b/drivers/ide/falconide.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <asm/atarihw.h> | 20 | #include <asm/atarihw.h> |
21 | #include <asm/atariints.h> | 21 | #include <asm/atariints.h> |
22 | #include <asm/atari_stdma.h> | 22 | #include <asm/atari_stdma.h> |
23 | #include <asm/ide.h> | ||
23 | 24 | ||
24 | #define DRV_NAME "falconide" | 25 | #define DRV_NAME "falconide" |
25 | 26 | ||
@@ -67,8 +68,10 @@ static void falconide_input_data(ide_drive_t *drive, struct ide_cmd *cmd, | |||
67 | { | 68 | { |
68 | unsigned long data_addr = drive->hwif->io_ports.data_addr; | 69 | unsigned long data_addr = drive->hwif->io_ports.data_addr; |
69 | 70 | ||
70 | if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS)) | 71 | if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS)) { |
71 | return insw(data_addr, buf, (len + 1) / 2); | 72 | __ide_mm_insw(data_addr, buf, (len + 1) / 2); |
73 | return; | ||
74 | } | ||
72 | 75 | ||
73 | raw_insw_swapw((u16 *)data_addr, buf, (len + 1) / 2); | 76 | raw_insw_swapw((u16 *)data_addr, buf, (len + 1) / 2); |
74 | } | 77 | } |
@@ -78,8 +81,10 @@ static void falconide_output_data(ide_drive_t *drive, struct ide_cmd *cmd, | |||
78 | { | 81 | { |
79 | unsigned long data_addr = drive->hwif->io_ports.data_addr; | 82 | unsigned long data_addr = drive->hwif->io_ports.data_addr; |
80 | 83 | ||
81 | if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS)) | 84 | if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS)) { |
82 | return outsw(data_addr, buf, (len + 1) / 2); | 85 | __ide_mm_outsw(data_addr, buf, (len + 1) / 2); |
86 | return; | ||
87 | } | ||
83 | 88 | ||
84 | raw_outsw_swapw((u16 *)data_addr, buf, (len + 1) / 2); | 89 | raw_outsw_swapw((u16 *)data_addr, buf, (len + 1) / 2); |
85 | } | 90 | } |
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index 12f436951bff..77f79d26b264 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c | |||
@@ -318,8 +318,9 @@ static int do_drive_set_taskfiles(ide_drive_t *drive, | |||
318 | 318 | ||
319 | /* convert GTF to taskfile */ | 319 | /* convert GTF to taskfile */ |
320 | memset(&cmd, 0, sizeof(cmd)); | 320 | memset(&cmd, 0, sizeof(cmd)); |
321 | memcpy(&cmd.tf_array[7], gtf, REGS_PER_GTF); | 321 | memcpy(&cmd.tf.feature, gtf, REGS_PER_GTF); |
322 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 322 | cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; |
323 | cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; | ||
323 | 324 | ||
324 | err = ide_no_data_taskfile(drive, &cmd); | 325 | err = ide_no_data_taskfile(drive, &cmd); |
325 | if (err) { | 326 | if (err) { |
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index 3e43b889dd64..7201b176d75b 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
@@ -254,16 +254,13 @@ EXPORT_SYMBOL_GPL(ide_cd_get_xferlen); | |||
254 | 254 | ||
255 | void ide_read_bcount_and_ireason(ide_drive_t *drive, u16 *bcount, u8 *ireason) | 255 | void ide_read_bcount_and_ireason(ide_drive_t *drive, u16 *bcount, u8 *ireason) |
256 | { | 256 | { |
257 | struct ide_cmd cmd; | 257 | struct ide_taskfile tf; |
258 | 258 | ||
259 | memset(&cmd, 0, sizeof(cmd)); | 259 | drive->hwif->tp_ops->tf_read(drive, &tf, IDE_VALID_NSECT | |
260 | cmd.tf_flags = IDE_TFLAG_IN_LBAH | IDE_TFLAG_IN_LBAM | | 260 | IDE_VALID_LBAM | IDE_VALID_LBAH); |
261 | IDE_TFLAG_IN_NSECT; | ||
262 | 261 | ||
263 | drive->hwif->tp_ops->tf_read(drive, &cmd); | 262 | *bcount = (tf.lbah << 8) | tf.lbam; |
264 | 263 | *ireason = tf.nsect & 3; | |
265 | *bcount = (cmd.tf.lbah << 8) | cmd.tf.lbam; | ||
266 | *ireason = cmd.tf.nsect & 3; | ||
267 | } | 264 | } |
268 | EXPORT_SYMBOL_GPL(ide_read_bcount_and_ireason); | 265 | EXPORT_SYMBOL_GPL(ide_read_bcount_and_ireason); |
269 | 266 | ||
@@ -439,12 +436,12 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) | |||
439 | return ide_started; | 436 | return ide_started; |
440 | } | 437 | } |
441 | 438 | ||
442 | static void ide_init_packet_cmd(struct ide_cmd *cmd, u32 tf_flags, | 439 | static void ide_init_packet_cmd(struct ide_cmd *cmd, u8 valid_tf, |
443 | u16 bcount, u8 dma) | 440 | u16 bcount, u8 dma) |
444 | { | 441 | { |
445 | cmd->protocol = dma ? ATAPI_PROT_DMA : ATAPI_PROT_PIO; | 442 | cmd->protocol = dma ? ATAPI_PROT_DMA : ATAPI_PROT_PIO; |
446 | cmd->tf_flags |= IDE_TFLAG_OUT_LBAH | IDE_TFLAG_OUT_LBAM | | 443 | cmd->valid.out.tf = IDE_VALID_LBAH | IDE_VALID_LBAM | |
447 | IDE_TFLAG_OUT_FEATURE | tf_flags; | 444 | IDE_VALID_FEATURE | valid_tf; |
448 | cmd->tf.command = ATA_CMD_PACKET; | 445 | cmd->tf.command = ATA_CMD_PACKET; |
449 | cmd->tf.feature = dma; /* Use PIO/DMA */ | 446 | cmd->tf.feature = dma; /* Use PIO/DMA */ |
450 | cmd->tf.lbam = bcount & 0xff; | 447 | cmd->tf.lbam = bcount & 0xff; |
@@ -453,14 +450,11 @@ static void ide_init_packet_cmd(struct ide_cmd *cmd, u32 tf_flags, | |||
453 | 450 | ||
454 | static u8 ide_read_ireason(ide_drive_t *drive) | 451 | static u8 ide_read_ireason(ide_drive_t *drive) |
455 | { | 452 | { |
456 | struct ide_cmd cmd; | 453 | struct ide_taskfile tf; |
457 | |||
458 | memset(&cmd, 0, sizeof(cmd)); | ||
459 | cmd.tf_flags = IDE_TFLAG_IN_NSECT; | ||
460 | 454 | ||
461 | drive->hwif->tp_ops->tf_read(drive, &cmd); | 455 | drive->hwif->tp_ops->tf_read(drive, &tf, IDE_VALID_NSECT); |
462 | 456 | ||
463 | return cmd.tf.nsect & 3; | 457 | return tf.nsect & 3; |
464 | } | 458 | } |
465 | 459 | ||
466 | static u8 ide_wait_ireason(ide_drive_t *drive, u8 ireason) | 460 | static u8 ide_wait_ireason(ide_drive_t *drive, u8 ireason) |
@@ -588,12 +582,12 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd) | |||
588 | ide_expiry_t *expiry = NULL; | 582 | ide_expiry_t *expiry = NULL; |
589 | struct request *rq = hwif->rq; | 583 | struct request *rq = hwif->rq; |
590 | unsigned int timeout; | 584 | unsigned int timeout; |
591 | u32 tf_flags; | ||
592 | u16 bcount; | 585 | u16 bcount; |
586 | u8 valid_tf; | ||
593 | u8 drq_int = !!(drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT); | 587 | u8 drq_int = !!(drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT); |
594 | 588 | ||
595 | if (dev_is_idecd(drive)) { | 589 | if (dev_is_idecd(drive)) { |
596 | tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL; | 590 | valid_tf = IDE_VALID_NSECT | IDE_VALID_LBAL; |
597 | bcount = ide_cd_get_xferlen(rq); | 591 | bcount = ide_cd_get_xferlen(rq); |
598 | expiry = ide_cd_expiry; | 592 | expiry = ide_cd_expiry; |
599 | timeout = ATAPI_WAIT_PC; | 593 | timeout = ATAPI_WAIT_PC; |
@@ -607,7 +601,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd) | |||
607 | pc->xferred = 0; | 601 | pc->xferred = 0; |
608 | pc->cur_pos = pc->buf; | 602 | pc->cur_pos = pc->buf; |
609 | 603 | ||
610 | tf_flags = IDE_TFLAG_OUT_DEVICE; | 604 | valid_tf = IDE_VALID_DEVICE; |
611 | bcount = ((drive->media == ide_tape) ? | 605 | bcount = ((drive->media == ide_tape) ? |
612 | pc->req_xfer : | 606 | pc->req_xfer : |
613 | min(pc->req_xfer, 63 * 1024)); | 607 | min(pc->req_xfer, 63 * 1024)); |
@@ -627,7 +621,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd) | |||
627 | : WAIT_TAPE_CMD; | 621 | : WAIT_TAPE_CMD; |
628 | } | 622 | } |
629 | 623 | ||
630 | ide_init_packet_cmd(cmd, tf_flags, bcount, drive->dma); | 624 | ide_init_packet_cmd(cmd, valid_tf, bcount, drive->dma); |
631 | 625 | ||
632 | (void)do_rw_taskfile(drive, cmd); | 626 | (void)do_rw_taskfile(drive, cmd); |
633 | 627 | ||
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 35729a47f797..3aec19d1fdfc 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -265,35 +265,62 @@ static void ide_cd_complete_failed_rq(ide_drive_t *drive, struct request *rq) | |||
265 | cdrom_analyze_sense_data(drive, NULL, sense); | 265 | cdrom_analyze_sense_data(drive, NULL, sense); |
266 | } | 266 | } |
267 | 267 | ||
268 | |||
268 | /* | 269 | /* |
270 | * Allow the drive 5 seconds to recover; some devices will return NOT_READY | ||
271 | * while flushing data from cache. | ||
272 | * | ||
273 | * returns: 0 failed (write timeout expired) | ||
274 | * 1 success | ||
275 | */ | ||
276 | static int ide_cd_breathe(ide_drive_t *drive, struct request *rq) | ||
277 | { | ||
278 | |||
279 | struct cdrom_info *info = drive->driver_data; | ||
280 | |||
281 | if (!rq->errors) | ||
282 | info->write_timeout = jiffies + ATAPI_WAIT_WRITE_BUSY; | ||
283 | |||
284 | rq->errors = 1; | ||
285 | |||
286 | if (time_after(jiffies, info->write_timeout)) | ||
287 | return 0; | ||
288 | else { | ||
289 | struct request_queue *q = drive->queue; | ||
290 | unsigned long flags; | ||
291 | |||
292 | /* | ||
293 | * take a breather relying on the unplug timer to kick us again | ||
294 | */ | ||
295 | |||
296 | spin_lock_irqsave(q->queue_lock, flags); | ||
297 | blk_plug_device(q); | ||
298 | spin_unlock_irqrestore(q->queue_lock, flags); | ||
299 | |||
300 | return 1; | ||
301 | } | ||
302 | } | ||
303 | |||
304 | /** | ||
269 | * Returns: | 305 | * Returns: |
270 | * 0: if the request should be continued. | 306 | * 0: if the request should be continued. |
271 | * 1: if the request will be going through error recovery. | 307 | * 1: if the request will be going through error recovery. |
272 | * 2: if the request should be ended. | 308 | * 2: if the request should be ended. |
273 | */ | 309 | */ |
274 | static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret) | 310 | static int cdrom_decode_status(ide_drive_t *drive, u8 stat) |
275 | { | 311 | { |
276 | ide_hwif_t *hwif = drive->hwif; | 312 | ide_hwif_t *hwif = drive->hwif; |
277 | struct request *rq = hwif->rq; | 313 | struct request *rq = hwif->rq; |
278 | int stat, err, sense_key; | 314 | int err, sense_key, do_end_request = 0; |
279 | 315 | u8 quiet = rq->cmd_flags & REQ_QUIET; | |
280 | /* check for errors */ | ||
281 | stat = hwif->tp_ops->read_status(hwif); | ||
282 | |||
283 | if (stat_ret) | ||
284 | *stat_ret = stat; | ||
285 | |||
286 | if (OK_STAT(stat, good_stat, BAD_R_STAT)) | ||
287 | return 0; | ||
288 | 316 | ||
289 | /* get the IDE error register */ | 317 | /* get the IDE error register */ |
290 | err = ide_read_error(drive); | 318 | err = ide_read_error(drive); |
291 | sense_key = err >> 4; | 319 | sense_key = err >> 4; |
292 | 320 | ||
293 | ide_debug_log(IDE_DBG_RQ, "stat: 0x%x, good_stat: 0x%x, cmd[0]: 0x%x, " | 321 | ide_debug_log(IDE_DBG_RQ, "cmd: 0x%x, rq->cmd_type: 0x%x, err: 0x%x, " |
294 | "rq->cmd_type: 0x%x, err: 0x%x", | 322 | "stat 0x%x", |
295 | stat, good_stat, rq->cmd[0], rq->cmd_type, | 323 | rq->cmd[0], rq->cmd_type, err, stat); |
296 | err); | ||
297 | 324 | ||
298 | if (blk_sense_request(rq)) { | 325 | if (blk_sense_request(rq)) { |
299 | /* | 326 | /* |
@@ -303,151 +330,108 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret) | |||
303 | */ | 330 | */ |
304 | rq->cmd_flags |= REQ_FAILED; | 331 | rq->cmd_flags |= REQ_FAILED; |
305 | return 2; | 332 | return 2; |
306 | } else if (blk_pc_request(rq) || rq->cmd_type == REQ_TYPE_ATA_PC) { | 333 | } |
307 | /* All other functions, except for READ. */ | ||
308 | 334 | ||
309 | /* | 335 | /* if we have an error, pass CHECK_CONDITION as the SCSI status byte */ |
310 | * if we have an error, pass back CHECK_CONDITION as the | 336 | if (blk_pc_request(rq) && !rq->errors) |
311 | * scsi status byte | 337 | rq->errors = SAM_STAT_CHECK_CONDITION; |
312 | */ | ||
313 | if (blk_pc_request(rq) && !rq->errors) | ||
314 | rq->errors = SAM_STAT_CHECK_CONDITION; | ||
315 | 338 | ||
316 | /* check for tray open */ | 339 | if (blk_noretry_request(rq)) |
317 | if (sense_key == NOT_READY) { | 340 | do_end_request = 1; |
318 | cdrom_saw_media_change(drive); | 341 | |
319 | } else if (sense_key == UNIT_ATTENTION) { | 342 | switch (sense_key) { |
320 | /* check for media change */ | 343 | case NOT_READY: |
344 | if (blk_fs_request(rq) && rq_data_dir(rq) == WRITE) { | ||
345 | if (ide_cd_breathe(drive, rq)) | ||
346 | return 1; | ||
347 | } else { | ||
321 | cdrom_saw_media_change(drive); | 348 | cdrom_saw_media_change(drive); |
322 | return 0; | 349 | |
323 | } else if (sense_key == ILLEGAL_REQUEST && | 350 | if (blk_fs_request(rq) && !quiet) |
324 | rq->cmd[0] == GPCMD_START_STOP_UNIT) { | 351 | printk(KERN_ERR PFX "%s: tray open\n", |
325 | /* | 352 | drive->name); |
326 | * Don't print error message for this condition-- | ||
327 | * SFF8090i indicates that 5/24/00 is the correct | ||
328 | * response to a request to close the tray if the | ||
329 | * drive doesn't have that capability. | ||
330 | * cdrom_log_sense() knows this! | ||
331 | */ | ||
332 | } else if (!(rq->cmd_flags & REQ_QUIET)) { | ||
333 | /* otherwise, print an error */ | ||
334 | ide_dump_status(drive, "packet command error", stat); | ||
335 | } | 353 | } |
354 | do_end_request = 1; | ||
355 | break; | ||
356 | case UNIT_ATTENTION: | ||
357 | cdrom_saw_media_change(drive); | ||
336 | 358 | ||
337 | rq->cmd_flags |= REQ_FAILED; | 359 | if (blk_fs_request(rq) == 0) |
360 | return 0; | ||
338 | 361 | ||
339 | /* | 362 | /* |
340 | * instead of playing games with moving completions around, | 363 | * Arrange to retry the request but be sure to give up if we've |
341 | * remove failed request completely and end it when the | 364 | * retried too many times. |
342 | * request sense has completed | ||
343 | */ | 365 | */ |
344 | goto end_request; | 366 | if (++rq->errors > ERROR_MAX) |
345 | |||
346 | } else if (blk_fs_request(rq)) { | ||
347 | int do_end_request = 0; | ||
348 | |||
349 | /* handle errors from READ and WRITE requests */ | ||
350 | |||
351 | if (blk_noretry_request(rq)) | ||
352 | do_end_request = 1; | 367 | do_end_request = 1; |
353 | 368 | break; | |
354 | if (sense_key == NOT_READY) { | 369 | case ILLEGAL_REQUEST: |
355 | /* tray open */ | 370 | /* |
356 | if (rq_data_dir(rq) == READ) { | 371 | * Don't print error message for this condition -- SFF8090i |
357 | cdrom_saw_media_change(drive); | 372 | * indicates that 5/24/00 is the correct response to a request |
358 | 373 | * to close the tray if the drive doesn't have that capability. | |
359 | /* fail the request */ | 374 | * |
360 | printk(KERN_ERR PFX "%s: tray open\n", | 375 | * cdrom_log_sense() knows this! |
361 | drive->name); | 376 | */ |
362 | do_end_request = 1; | 377 | if (rq->cmd[0] == GPCMD_START_STOP_UNIT) |
363 | } else { | 378 | break; |
364 | struct cdrom_info *info = drive->driver_data; | 379 | /* fall-through */ |
365 | 380 | case DATA_PROTECT: | |
366 | /* | 381 | /* |
367 | * Allow the drive 5 seconds to recover, some | 382 | * No point in retrying after an illegal request or data |
368 | * devices will return this error while flushing | 383 | * protect error. |
369 | * data from cache. | 384 | */ |
370 | */ | 385 | if (!quiet) |
371 | if (!rq->errors) | ||
372 | info->write_timeout = jiffies + | ||
373 | ATAPI_WAIT_WRITE_BUSY; | ||
374 | rq->errors = 1; | ||
375 | if (time_after(jiffies, info->write_timeout)) | ||
376 | do_end_request = 1; | ||
377 | else { | ||
378 | struct request_queue *q = drive->queue; | ||
379 | unsigned long flags; | ||
380 | |||
381 | /* | ||
382 | * take a breather relying on the unplug | ||
383 | * timer to kick us again | ||
384 | */ | ||
385 | spin_lock_irqsave(q->queue_lock, flags); | ||
386 | blk_plug_device(q); | ||
387 | spin_unlock_irqrestore(q->queue_lock, flags); | ||
388 | |||
389 | return 1; | ||
390 | } | ||
391 | } | ||
392 | } else if (sense_key == UNIT_ATTENTION) { | ||
393 | /* media change */ | ||
394 | cdrom_saw_media_change(drive); | ||
395 | |||
396 | /* | ||
397 | * Arrange to retry the request but be sure to give up | ||
398 | * if we've retried too many times. | ||
399 | */ | ||
400 | if (++rq->errors > ERROR_MAX) | ||
401 | do_end_request = 1; | ||
402 | } else if (sense_key == ILLEGAL_REQUEST || | ||
403 | sense_key == DATA_PROTECT) { | ||
404 | /* | ||
405 | * No point in retrying after an illegal request or data | ||
406 | * protect error. | ||
407 | */ | ||
408 | ide_dump_status(drive, "command error", stat); | 386 | ide_dump_status(drive, "command error", stat); |
409 | do_end_request = 1; | 387 | do_end_request = 1; |
410 | } else if (sense_key == MEDIUM_ERROR) { | 388 | break; |
411 | /* | 389 | case MEDIUM_ERROR: |
412 | * No point in re-trying a zillion times on a bad | 390 | /* |
413 | * sector. If we got here the error is not correctable. | 391 | * No point in re-trying a zillion times on a bad sector. |
414 | */ | 392 | * If we got here the error is not correctable. |
415 | ide_dump_status(drive, "media error (bad sector)", | 393 | */ |
394 | if (!quiet) | ||
395 | ide_dump_status(drive, "media error " | ||
396 | "(bad sector)", stat); | ||
397 | do_end_request = 1; | ||
398 | break; | ||
399 | case BLANK_CHECK: | ||
400 | /* disk appears blank? */ | ||
401 | if (!quiet) | ||
402 | ide_dump_status(drive, "media error (blank)", | ||
416 | stat); | 403 | stat); |
417 | do_end_request = 1; | 404 | do_end_request = 1; |
418 | } else if (sense_key == BLANK_CHECK) { | 405 | break; |
419 | /* disk appears blank ?? */ | 406 | default: |
420 | ide_dump_status(drive, "media error (blank)", stat); | 407 | if (blk_fs_request(rq) == 0) |
421 | do_end_request = 1; | 408 | break; |
422 | } else if ((err & ~ATA_ABORTED) != 0) { | 409 | if (err & ~ATA_ABORTED) { |
423 | /* go to the default handler for other errors */ | 410 | /* go to the default handler for other errors */ |
424 | ide_error(drive, "cdrom_decode_status", stat); | 411 | ide_error(drive, "cdrom_decode_status", stat); |
425 | return 1; | 412 | return 1; |
426 | } else if ((++rq->errors > ERROR_MAX)) { | 413 | } else if (++rq->errors > ERROR_MAX) |
427 | /* we've racked up too many retries, abort */ | 414 | /* we've racked up too many retries, abort */ |
428 | do_end_request = 1; | 415 | do_end_request = 1; |
429 | } | 416 | } |
430 | |||
431 | /* | ||
432 | * End a request through request sense analysis when we have | ||
433 | * sense data. We need this in order to perform end of media | ||
434 | * processing. | ||
435 | */ | ||
436 | if (do_end_request) | ||
437 | goto end_request; | ||
438 | 417 | ||
439 | /* | 418 | if (blk_fs_request(rq) == 0) { |
440 | * If we got a CHECK_CONDITION status, queue | 419 | rq->cmd_flags |= REQ_FAILED; |
441 | * a request sense command. | 420 | do_end_request = 1; |
442 | */ | ||
443 | if (stat & ATA_ERR) | ||
444 | cdrom_queue_request_sense(drive, NULL, NULL); | ||
445 | return 1; | ||
446 | } else { | ||
447 | blk_dump_rq_flags(rq, PFX "bad rq"); | ||
448 | return 2; | ||
449 | } | 421 | } |
450 | 422 | ||
423 | /* | ||
424 | * End a request through request sense analysis when we have sense data. | ||
425 | * We need this in order to perform end of media processing. | ||
426 | */ | ||
427 | if (do_end_request) | ||
428 | goto end_request; | ||
429 | |||
430 | /* if we got a CHECK_CONDITION status, queue a request sense command */ | ||
431 | if (stat & ATA_ERR) | ||
432 | cdrom_queue_request_sense(drive, NULL, NULL); | ||
433 | return 1; | ||
434 | |||
451 | end_request: | 435 | end_request: |
452 | if (stat & ATA_ERR) { | 436 | if (stat & ATA_ERR) { |
453 | struct request_queue *q = drive->queue; | 437 | struct request_queue *q = drive->queue; |
@@ -624,15 +608,14 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
624 | struct ide_cmd *cmd = &hwif->cmd; | 608 | struct ide_cmd *cmd = &hwif->cmd; |
625 | struct request *rq = hwif->rq; | 609 | struct request *rq = hwif->rq; |
626 | ide_expiry_t *expiry = NULL; | 610 | ide_expiry_t *expiry = NULL; |
627 | int dma_error = 0, dma, stat, thislen, uptodate = 0; | 611 | int dma_error = 0, dma, thislen, uptodate = 0; |
628 | int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc, nsectors; | 612 | int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc, nsectors; |
629 | int sense = blk_sense_request(rq); | 613 | int sense = blk_sense_request(rq); |
630 | unsigned int timeout; | 614 | unsigned int timeout; |
631 | u16 len; | 615 | u16 len; |
632 | u8 ireason; | 616 | u8 ireason, stat; |
633 | 617 | ||
634 | ide_debug_log(IDE_DBG_PC, "cmd[0]: 0x%x, write: 0x%x", | 618 | ide_debug_log(IDE_DBG_PC, "cmd: 0x%x, write: 0x%x", rq->cmd[0], write); |
635 | rq->cmd[0], write); | ||
636 | 619 | ||
637 | /* check for errors */ | 620 | /* check for errors */ |
638 | dma = drive->dma; | 621 | dma = drive->dma; |
@@ -648,11 +631,16 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
648 | } | 631 | } |
649 | } | 632 | } |
650 | 633 | ||
651 | rc = cdrom_decode_status(drive, 0, &stat); | 634 | /* check status */ |
652 | if (rc) { | 635 | stat = hwif->tp_ops->read_status(hwif); |
653 | if (rc == 2) | 636 | |
654 | goto out_end; | 637 | if (!OK_STAT(stat, 0, BAD_R_STAT)) { |
655 | return ide_stopped; | 638 | rc = cdrom_decode_status(drive, stat); |
639 | if (rc) { | ||
640 | if (rc == 2) | ||
641 | goto out_end; | ||
642 | return ide_stopped; | ||
643 | } | ||
656 | } | 644 | } |
657 | 645 | ||
658 | /* using dma, transfer is complete now */ | 646 | /* using dma, transfer is complete now */ |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index c998cf8e971a..a9fbe2c31210 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -97,35 +97,38 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
97 | } | 97 | } |
98 | 98 | ||
99 | memset(&cmd, 0, sizeof(cmd)); | 99 | memset(&cmd, 0, sizeof(cmd)); |
100 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 100 | cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; |
101 | cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; | ||
101 | 102 | ||
102 | if (drive->dev_flags & IDE_DFLAG_LBA) { | 103 | if (drive->dev_flags & IDE_DFLAG_LBA) { |
103 | if (lba48) { | 104 | if (lba48) { |
104 | pr_debug("%s: LBA=0x%012llx\n", drive->name, | 105 | pr_debug("%s: LBA=0x%012llx\n", drive->name, |
105 | (unsigned long long)block); | 106 | (unsigned long long)block); |
106 | 107 | ||
107 | tf->hob_nsect = (nsectors >> 8) & 0xff; | ||
108 | tf->hob_lbal = (u8)(block >> 24); | ||
109 | if (sizeof(block) != 4) { | ||
110 | tf->hob_lbam = (u8)((u64)block >> 32); | ||
111 | tf->hob_lbah = (u8)((u64)block >> 40); | ||
112 | } | ||
113 | |||
114 | tf->nsect = nsectors & 0xff; | 108 | tf->nsect = nsectors & 0xff; |
115 | tf->lbal = (u8) block; | 109 | tf->lbal = (u8) block; |
116 | tf->lbam = (u8)(block >> 8); | 110 | tf->lbam = (u8)(block >> 8); |
117 | tf->lbah = (u8)(block >> 16); | 111 | tf->lbah = (u8)(block >> 16); |
112 | tf->device = ATA_LBA; | ||
118 | 113 | ||
119 | cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); | 114 | tf = &cmd.hob; |
115 | tf->nsect = (nsectors >> 8) & 0xff; | ||
116 | tf->lbal = (u8)(block >> 24); | ||
117 | if (sizeof(block) != 4) { | ||
118 | tf->lbam = (u8)((u64)block >> 32); | ||
119 | tf->lbah = (u8)((u64)block >> 40); | ||
120 | } | ||
121 | |||
122 | cmd.valid.out.hob = IDE_VALID_OUT_HOB; | ||
123 | cmd.valid.in.hob = IDE_VALID_IN_HOB; | ||
124 | cmd.tf_flags |= IDE_TFLAG_LBA48; | ||
120 | } else { | 125 | } else { |
121 | tf->nsect = nsectors & 0xff; | 126 | tf->nsect = nsectors & 0xff; |
122 | tf->lbal = block; | 127 | tf->lbal = block; |
123 | tf->lbam = block >>= 8; | 128 | tf->lbam = block >>= 8; |
124 | tf->lbah = block >>= 8; | 129 | tf->lbah = block >>= 8; |
125 | tf->device = (block >> 8) & 0xf; | 130 | tf->device = ((block >> 8) & 0xf) | ATA_LBA; |
126 | } | 131 | } |
127 | |||
128 | tf->device |= ATA_LBA; | ||
129 | } else { | 132 | } else { |
130 | unsigned int sect, head, cyl, track; | 133 | unsigned int sect, head, cyl, track; |
131 | 134 | ||
@@ -220,15 +223,19 @@ static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48) | |||
220 | tf->command = ATA_CMD_READ_NATIVE_MAX; | 223 | tf->command = ATA_CMD_READ_NATIVE_MAX; |
221 | tf->device = ATA_LBA; | 224 | tf->device = ATA_LBA; |
222 | 225 | ||
223 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 226 | cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; |
224 | if (lba48) | 227 | cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; |
225 | cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); | 228 | if (lba48) { |
229 | cmd.valid.out.hob = IDE_VALID_OUT_HOB; | ||
230 | cmd.valid.in.hob = IDE_VALID_IN_HOB; | ||
231 | cmd.tf_flags = IDE_TFLAG_LBA48; | ||
232 | } | ||
226 | 233 | ||
227 | ide_no_data_taskfile(drive, &cmd); | 234 | ide_no_data_taskfile(drive, &cmd); |
228 | 235 | ||
229 | /* if OK, compute maximum address value */ | 236 | /* if OK, compute maximum address value */ |
230 | if (!(tf->status & ATA_ERR)) | 237 | if (!(tf->status & ATA_ERR)) |
231 | addr = ide_get_lba_addr(tf, lba48) + 1; | 238 | addr = ide_get_lba_addr(&cmd, lba48) + 1; |
232 | 239 | ||
233 | return addr; | 240 | return addr; |
234 | } | 241 | } |
@@ -250,9 +257,9 @@ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48) | |||
250 | tf->lbam = (addr_req >>= 8) & 0xff; | 257 | tf->lbam = (addr_req >>= 8) & 0xff; |
251 | tf->lbah = (addr_req >>= 8) & 0xff; | 258 | tf->lbah = (addr_req >>= 8) & 0xff; |
252 | if (lba48) { | 259 | if (lba48) { |
253 | tf->hob_lbal = (addr_req >>= 8) & 0xff; | 260 | cmd.hob.lbal = (addr_req >>= 8) & 0xff; |
254 | tf->hob_lbam = (addr_req >>= 8) & 0xff; | 261 | cmd.hob.lbam = (addr_req >>= 8) & 0xff; |
255 | tf->hob_lbah = (addr_req >>= 8) & 0xff; | 262 | cmd.hob.lbah = (addr_req >>= 8) & 0xff; |
256 | tf->command = ATA_CMD_SET_MAX_EXT; | 263 | tf->command = ATA_CMD_SET_MAX_EXT; |
257 | } else { | 264 | } else { |
258 | tf->device = (addr_req >>= 8) & 0x0f; | 265 | tf->device = (addr_req >>= 8) & 0x0f; |
@@ -260,15 +267,19 @@ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48) | |||
260 | } | 267 | } |
261 | tf->device |= ATA_LBA; | 268 | tf->device |= ATA_LBA; |
262 | 269 | ||
263 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 270 | cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; |
264 | if (lba48) | 271 | cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; |
265 | cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); | 272 | if (lba48) { |
273 | cmd.valid.out.hob = IDE_VALID_OUT_HOB; | ||
274 | cmd.valid.in.hob = IDE_VALID_IN_HOB; | ||
275 | cmd.tf_flags = IDE_TFLAG_LBA48; | ||
276 | } | ||
266 | 277 | ||
267 | ide_no_data_taskfile(drive, &cmd); | 278 | ide_no_data_taskfile(drive, &cmd); |
268 | 279 | ||
269 | /* if OK, compute maximum address value */ | 280 | /* if OK, compute maximum address value */ |
270 | if (!(tf->status & ATA_ERR)) | 281 | if (!(tf->status & ATA_ERR)) |
271 | addr_set = ide_get_lba_addr(tf, lba48) + 1; | 282 | addr_set = ide_get_lba_addr(&cmd, lba48) + 1; |
272 | 283 | ||
273 | return addr_set; | 284 | return addr_set; |
274 | } | 285 | } |
@@ -395,8 +406,8 @@ static void idedisk_prepare_flush(struct request_queue *q, struct request *rq) | |||
395 | cmd->tf.command = ATA_CMD_FLUSH_EXT; | 406 | cmd->tf.command = ATA_CMD_FLUSH_EXT; |
396 | else | 407 | else |
397 | cmd->tf.command = ATA_CMD_FLUSH; | 408 | cmd->tf.command = ATA_CMD_FLUSH; |
398 | cmd->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE | | 409 | cmd->valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; |
399 | IDE_TFLAG_DYN; | 410 | cmd->tf_flags = IDE_TFLAG_DYN; |
400 | cmd->protocol = ATA_PROT_NODATA; | 411 | cmd->protocol = ATA_PROT_NODATA; |
401 | 412 | ||
402 | rq->cmd_type = REQ_TYPE_ATA_TASKFILE; | 413 | rq->cmd_type = REQ_TYPE_ATA_TASKFILE; |
@@ -457,7 +468,8 @@ static int ide_do_setfeature(ide_drive_t *drive, u8 feature, u8 nsect) | |||
457 | cmd.tf.feature = feature; | 468 | cmd.tf.feature = feature; |
458 | cmd.tf.nsect = nsect; | 469 | cmd.tf.nsect = nsect; |
459 | cmd.tf.command = ATA_CMD_SET_FEATURES; | 470 | cmd.tf.command = ATA_CMD_SET_FEATURES; |
460 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 471 | cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; |
472 | cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; | ||
461 | 473 | ||
462 | return ide_no_data_taskfile(drive, &cmd); | 474 | return ide_no_data_taskfile(drive, &cmd); |
463 | } | 475 | } |
@@ -533,7 +545,8 @@ static int do_idedisk_flushcache(ide_drive_t *drive) | |||
533 | cmd.tf.command = ATA_CMD_FLUSH_EXT; | 545 | cmd.tf.command = ATA_CMD_FLUSH_EXT; |
534 | else | 546 | else |
535 | cmd.tf.command = ATA_CMD_FLUSH; | 547 | cmd.tf.command = ATA_CMD_FLUSH; |
536 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 548 | cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; |
549 | cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; | ||
537 | 550 | ||
538 | return ide_no_data_taskfile(drive, &cmd); | 551 | return ide_no_data_taskfile(drive, &cmd); |
539 | } | 552 | } |
@@ -715,7 +728,8 @@ static int ide_disk_set_doorlock(ide_drive_t *drive, struct gendisk *disk, | |||
715 | 728 | ||
716 | memset(&cmd, 0, sizeof(cmd)); | 729 | memset(&cmd, 0, sizeof(cmd)); |
717 | cmd.tf.command = on ? ATA_CMD_MEDIA_LOCK : ATA_CMD_MEDIA_UNLOCK; | 730 | cmd.tf.command = on ? ATA_CMD_MEDIA_LOCK : ATA_CMD_MEDIA_UNLOCK; |
718 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 731 | cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; |
732 | cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; | ||
719 | 733 | ||
720 | ret = ide_no_data_taskfile(drive, &cmd); | 734 | ret = ide_no_data_taskfile(drive, &cmd); |
721 | 735 | ||
diff --git a/drivers/ide/ide-disk_proc.c b/drivers/ide/ide-disk_proc.c index eaea3bef2073..19f263bf0a9e 100644 --- a/drivers/ide/ide-disk_proc.c +++ b/drivers/ide/ide-disk_proc.c | |||
@@ -13,7 +13,8 @@ static int smart_enable(ide_drive_t *drive) | |||
13 | tf->lbam = ATA_SMART_LBAM_PASS; | 13 | tf->lbam = ATA_SMART_LBAM_PASS; |
14 | tf->lbah = ATA_SMART_LBAH_PASS; | 14 | tf->lbah = ATA_SMART_LBAH_PASS; |
15 | tf->command = ATA_CMD_SMART; | 15 | tf->command = ATA_CMD_SMART; |
16 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 16 | cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; |
17 | cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; | ||
17 | 18 | ||
18 | return ide_no_data_taskfile(drive, &cmd); | 19 | return ide_no_data_taskfile(drive, &cmd); |
19 | } | 20 | } |
@@ -29,7 +30,8 @@ static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd) | |||
29 | tf->lbam = ATA_SMART_LBAM_PASS; | 30 | tf->lbam = ATA_SMART_LBAM_PASS; |
30 | tf->lbah = ATA_SMART_LBAH_PASS; | 31 | tf->lbah = ATA_SMART_LBAH_PASS; |
31 | tf->command = ATA_CMD_SMART; | 32 | tf->command = ATA_CMD_SMART; |
32 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 33 | cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; |
34 | cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; | ||
33 | cmd.protocol = ATA_PROT_PIO; | 35 | cmd.protocol = ATA_PROT_PIO; |
34 | 36 | ||
35 | return ide_raw_taskfile(drive, &cmd, buf, 1); | 37 | return ide_raw_taskfile(drive, &cmd, buf, 1); |
diff --git a/drivers/ide/ide-dma-sff.c b/drivers/ide/ide-dma-sff.c index 16fc46edc32d..e4cdf78cc3e9 100644 --- a/drivers/ide/ide-dma-sff.c +++ b/drivers/ide/ide-dma-sff.c | |||
@@ -277,8 +277,6 @@ void ide_dma_start(ide_drive_t *drive) | |||
277 | dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD); | 277 | dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD); |
278 | outb(dma_cmd | ATA_DMA_START, hwif->dma_base + ATA_DMA_CMD); | 278 | outb(dma_cmd | ATA_DMA_START, hwif->dma_base + ATA_DMA_CMD); |
279 | } | 279 | } |
280 | |||
281 | wmb(); | ||
282 | } | 280 | } |
283 | EXPORT_SYMBOL_GPL(ide_dma_start); | 281 | EXPORT_SYMBOL_GPL(ide_dma_start); |
284 | 282 | ||
@@ -286,7 +284,7 @@ EXPORT_SYMBOL_GPL(ide_dma_start); | |||
286 | int ide_dma_end(ide_drive_t *drive) | 284 | int ide_dma_end(ide_drive_t *drive) |
287 | { | 285 | { |
288 | ide_hwif_t *hwif = drive->hwif; | 286 | ide_hwif_t *hwif = drive->hwif; |
289 | u8 dma_stat = 0, dma_cmd = 0, mask; | 287 | u8 dma_stat = 0, dma_cmd = 0; |
290 | 288 | ||
291 | /* stop DMA */ | 289 | /* stop DMA */ |
292 | if (hwif->host_flags & IDE_HFLAG_MMIO) { | 290 | if (hwif->host_flags & IDE_HFLAG_MMIO) { |
@@ -304,11 +302,10 @@ int ide_dma_end(ide_drive_t *drive) | |||
304 | /* clear INTR & ERROR bits */ | 302 | /* clear INTR & ERROR bits */ |
305 | ide_dma_sff_write_status(hwif, dma_stat | ATA_DMA_ERR | ATA_DMA_INTR); | 303 | ide_dma_sff_write_status(hwif, dma_stat | ATA_DMA_ERR | ATA_DMA_INTR); |
306 | 304 | ||
307 | wmb(); | 305 | #define CHECK_DMA_MASK (ATA_DMA_ACTIVE | ATA_DMA_ERR | ATA_DMA_INTR) |
308 | 306 | ||
309 | /* verify good DMA status */ | 307 | /* verify good DMA status */ |
310 | mask = ATA_DMA_ACTIVE | ATA_DMA_ERR | ATA_DMA_INTR; | 308 | if ((dma_stat & CHECK_DMA_MASK) != ATA_DMA_INTR) |
311 | if ((dma_stat & mask) != ATA_DMA_INTR) | ||
312 | return 0x10 | dma_stat; | 309 | return 0x10 | dma_stat; |
313 | return 0; | 310 | return 0; |
314 | } | 311 | } |
diff --git a/drivers/ide/ide-h8300.c b/drivers/ide/ide-h8300.c index dac9a6d44963..c06ebdc4a130 100644 --- a/drivers/ide/ide-h8300.c +++ b/drivers/ide/ide-h8300.c | |||
@@ -22,103 +22,6 @@ | |||
22 | (r); \ | 22 | (r); \ |
23 | }) | 23 | }) |
24 | 24 | ||
25 | static void mm_outw(u16 d, unsigned long a) | ||
26 | { | ||
27 | __asm__("mov.b %w0,r2h\n\t" | ||
28 | "mov.b %x0,r2l\n\t" | ||
29 | "mov.w r2,@%1" | ||
30 | : | ||
31 | :"r"(d),"r"(a) | ||
32 | :"er2"); | ||
33 | } | ||
34 | |||
35 | static u16 mm_inw(unsigned long a) | ||
36 | { | ||
37 | register u16 r __asm__("er0"); | ||
38 | __asm__("mov.w @%1,r2\n\t" | ||
39 | "mov.b r2l,%x0\n\t" | ||
40 | "mov.b r2h,%w0" | ||
41 | :"=r"(r) | ||
42 | :"r"(a) | ||
43 | :"er2"); | ||
44 | return r; | ||
45 | } | ||
46 | |||
47 | static void h8300_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) | ||
48 | { | ||
49 | ide_hwif_t *hwif = drive->hwif; | ||
50 | struct ide_io_ports *io_ports = &hwif->io_ports; | ||
51 | struct ide_taskfile *tf = &cmd->tf; | ||
52 | u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; | ||
53 | |||
54 | if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) | ||
55 | HIHI = 0xFF; | ||
56 | |||
57 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) | ||
58 | outb(tf->hob_feature, io_ports->feature_addr); | ||
59 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) | ||
60 | outb(tf->hob_nsect, io_ports->nsect_addr); | ||
61 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) | ||
62 | outb(tf->hob_lbal, io_ports->lbal_addr); | ||
63 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) | ||
64 | outb(tf->hob_lbam, io_ports->lbam_addr); | ||
65 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) | ||
66 | outb(tf->hob_lbah, io_ports->lbah_addr); | ||
67 | |||
68 | if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) | ||
69 | outb(tf->feature, io_ports->feature_addr); | ||
70 | if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) | ||
71 | outb(tf->nsect, io_ports->nsect_addr); | ||
72 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) | ||
73 | outb(tf->lbal, io_ports->lbal_addr); | ||
74 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) | ||
75 | outb(tf->lbam, io_ports->lbam_addr); | ||
76 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) | ||
77 | outb(tf->lbah, io_ports->lbah_addr); | ||
78 | |||
79 | if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) | ||
80 | outb((tf->device & HIHI) | drive->select, | ||
81 | io_ports->device_addr); | ||
82 | } | ||
83 | |||
84 | static void h8300_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) | ||
85 | { | ||
86 | ide_hwif_t *hwif = drive->hwif; | ||
87 | struct ide_io_ports *io_ports = &hwif->io_ports; | ||
88 | struct ide_taskfile *tf = &cmd->tf; | ||
89 | |||
90 | /* be sure we're looking at the low order bits */ | ||
91 | outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); | ||
92 | |||
93 | if (cmd->tf_flags & IDE_TFLAG_IN_ERROR) | ||
94 | tf->error = inb(io_ports->feature_addr); | ||
95 | if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) | ||
96 | tf->nsect = inb(io_ports->nsect_addr); | ||
97 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) | ||
98 | tf->lbal = inb(io_ports->lbal_addr); | ||
99 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) | ||
100 | tf->lbam = inb(io_ports->lbam_addr); | ||
101 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) | ||
102 | tf->lbah = inb(io_ports->lbah_addr); | ||
103 | if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) | ||
104 | tf->device = inb(io_ports->device_addr); | ||
105 | |||
106 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { | ||
107 | outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr); | ||
108 | |||
109 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_ERROR) | ||
110 | tf->hob_error = inb(io_ports->feature_addr); | ||
111 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) | ||
112 | tf->hob_nsect = inb(io_ports->nsect_addr); | ||
113 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) | ||
114 | tf->hob_lbal = inb(io_ports->lbal_addr); | ||
115 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) | ||
116 | tf->hob_lbam = inb(io_ports->lbam_addr); | ||
117 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) | ||
118 | tf->hob_lbah = inb(io_ports->lbah_addr); | ||
119 | } | ||
120 | } | ||
121 | |||
122 | static void mm_outsw(unsigned long addr, void *buf, u32 len) | 25 | static void mm_outsw(unsigned long addr, void *buf, u32 len) |
123 | { | 26 | { |
124 | unsigned short *bp = (unsigned short *)buf; | 27 | unsigned short *bp = (unsigned short *)buf; |
@@ -152,8 +55,8 @@ static const struct ide_tp_ops h8300_tp_ops = { | |||
152 | .write_devctl = ide_write_devctl, | 55 | .write_devctl = ide_write_devctl, |
153 | 56 | ||
154 | .dev_select = ide_dev_select, | 57 | .dev_select = ide_dev_select, |
155 | .tf_load = h8300_tf_load, | 58 | .tf_load = ide_tf_load, |
156 | .tf_read = h8300_tf_read, | 59 | .tf_read = ide_tf_read, |
157 | 60 | ||
158 | .input_data = h8300_input_data, | 61 | .input_data = h8300_input_data, |
159 | .output_data = h8300_output_data, | 62 | .output_data = h8300_output_data, |
diff --git a/drivers/ide/ide-io-std.c b/drivers/ide/ide-io-std.c index 9cac281d82c4..46721c454518 100644 --- a/drivers/ide/ide-io-std.c +++ b/drivers/ide/ide-io-std.c | |||
@@ -85,98 +85,57 @@ void ide_dev_select(ide_drive_t *drive) | |||
85 | } | 85 | } |
86 | EXPORT_SYMBOL_GPL(ide_dev_select); | 86 | EXPORT_SYMBOL_GPL(ide_dev_select); |
87 | 87 | ||
88 | void ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) | 88 | void ide_tf_load(ide_drive_t *drive, struct ide_taskfile *tf, u8 valid) |
89 | { | 89 | { |
90 | ide_hwif_t *hwif = drive->hwif; | 90 | ide_hwif_t *hwif = drive->hwif; |
91 | struct ide_io_ports *io_ports = &hwif->io_ports; | 91 | struct ide_io_ports *io_ports = &hwif->io_ports; |
92 | struct ide_taskfile *tf = &cmd->tf; | ||
93 | void (*tf_outb)(u8 addr, unsigned long port); | 92 | void (*tf_outb)(u8 addr, unsigned long port); |
94 | u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; | 93 | u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; |
95 | u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; | ||
96 | 94 | ||
97 | if (mmio) | 95 | if (mmio) |
98 | tf_outb = ide_mm_outb; | 96 | tf_outb = ide_mm_outb; |
99 | else | 97 | else |
100 | tf_outb = ide_outb; | 98 | tf_outb = ide_outb; |
101 | 99 | ||
102 | if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) | 100 | if (valid & IDE_VALID_FEATURE) |
103 | HIHI = 0xFF; | ||
104 | |||
105 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) | ||
106 | tf_outb(tf->hob_feature, io_ports->feature_addr); | ||
107 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) | ||
108 | tf_outb(tf->hob_nsect, io_ports->nsect_addr); | ||
109 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) | ||
110 | tf_outb(tf->hob_lbal, io_ports->lbal_addr); | ||
111 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) | ||
112 | tf_outb(tf->hob_lbam, io_ports->lbam_addr); | ||
113 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) | ||
114 | tf_outb(tf->hob_lbah, io_ports->lbah_addr); | ||
115 | |||
116 | if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) | ||
117 | tf_outb(tf->feature, io_ports->feature_addr); | 101 | tf_outb(tf->feature, io_ports->feature_addr); |
118 | if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) | 102 | if (valid & IDE_VALID_NSECT) |
119 | tf_outb(tf->nsect, io_ports->nsect_addr); | 103 | tf_outb(tf->nsect, io_ports->nsect_addr); |
120 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) | 104 | if (valid & IDE_VALID_LBAL) |
121 | tf_outb(tf->lbal, io_ports->lbal_addr); | 105 | tf_outb(tf->lbal, io_ports->lbal_addr); |
122 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) | 106 | if (valid & IDE_VALID_LBAM) |
123 | tf_outb(tf->lbam, io_ports->lbam_addr); | 107 | tf_outb(tf->lbam, io_ports->lbam_addr); |
124 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) | 108 | if (valid & IDE_VALID_LBAH) |
125 | tf_outb(tf->lbah, io_ports->lbah_addr); | 109 | tf_outb(tf->lbah, io_ports->lbah_addr); |
126 | 110 | if (valid & IDE_VALID_DEVICE) | |
127 | if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) | 111 | tf_outb(tf->device, io_ports->device_addr); |
128 | tf_outb((tf->device & HIHI) | drive->select, | ||
129 | io_ports->device_addr); | ||
130 | } | 112 | } |
131 | EXPORT_SYMBOL_GPL(ide_tf_load); | 113 | EXPORT_SYMBOL_GPL(ide_tf_load); |
132 | 114 | ||
133 | void ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) | 115 | void ide_tf_read(ide_drive_t *drive, struct ide_taskfile *tf, u8 valid) |
134 | { | 116 | { |
135 | ide_hwif_t *hwif = drive->hwif; | 117 | ide_hwif_t *hwif = drive->hwif; |
136 | struct ide_io_ports *io_ports = &hwif->io_ports; | 118 | struct ide_io_ports *io_ports = &hwif->io_ports; |
137 | struct ide_taskfile *tf = &cmd->tf; | ||
138 | void (*tf_outb)(u8 addr, unsigned long port); | ||
139 | u8 (*tf_inb)(unsigned long port); | 119 | u8 (*tf_inb)(unsigned long port); |
140 | u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; | 120 | u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; |
141 | 121 | ||
142 | if (mmio) { | 122 | if (mmio) |
143 | tf_outb = ide_mm_outb; | ||
144 | tf_inb = ide_mm_inb; | 123 | tf_inb = ide_mm_inb; |
145 | } else { | 124 | else |
146 | tf_outb = ide_outb; | ||
147 | tf_inb = ide_inb; | 125 | tf_inb = ide_inb; |
148 | } | ||
149 | |||
150 | /* be sure we're looking at the low order bits */ | ||
151 | tf_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); | ||
152 | 126 | ||
153 | if (cmd->tf_flags & IDE_TFLAG_IN_ERROR) | 127 | if (valid & IDE_VALID_ERROR) |
154 | tf->error = tf_inb(io_ports->feature_addr); | 128 | tf->error = tf_inb(io_ports->feature_addr); |
155 | if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) | 129 | if (valid & IDE_VALID_NSECT) |
156 | tf->nsect = tf_inb(io_ports->nsect_addr); | 130 | tf->nsect = tf_inb(io_ports->nsect_addr); |
157 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) | 131 | if (valid & IDE_VALID_LBAL) |
158 | tf->lbal = tf_inb(io_ports->lbal_addr); | 132 | tf->lbal = tf_inb(io_ports->lbal_addr); |
159 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) | 133 | if (valid & IDE_VALID_LBAM) |
160 | tf->lbam = tf_inb(io_ports->lbam_addr); | 134 | tf->lbam = tf_inb(io_ports->lbam_addr); |
161 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) | 135 | if (valid & IDE_VALID_LBAH) |
162 | tf->lbah = tf_inb(io_ports->lbah_addr); | 136 | tf->lbah = tf_inb(io_ports->lbah_addr); |
163 | if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) | 137 | if (valid & IDE_VALID_DEVICE) |
164 | tf->device = tf_inb(io_ports->device_addr); | 138 | tf->device = tf_inb(io_ports->device_addr); |
165 | |||
166 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { | ||
167 | tf_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr); | ||
168 | |||
169 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_ERROR) | ||
170 | tf->hob_error = tf_inb(io_ports->feature_addr); | ||
171 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) | ||
172 | tf->hob_nsect = tf_inb(io_ports->nsect_addr); | ||
173 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) | ||
174 | tf->hob_lbal = tf_inb(io_ports->lbal_addr); | ||
175 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) | ||
176 | tf->hob_lbam = tf_inb(io_ports->lbam_addr); | ||
177 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) | ||
178 | tf->hob_lbah = tf_inb(io_ports->lbah_addr); | ||
179 | } | ||
180 | } | 139 | } |
181 | EXPORT_SYMBOL_GPL(ide_tf_read); | 140 | EXPORT_SYMBOL_GPL(ide_tf_read); |
182 | 141 | ||
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 1deb6d29b186..2ae02b8d7f8e 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -86,18 +86,18 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) | |||
86 | 86 | ||
87 | tp_ops->input_data(drive, cmd, data, 2); | 87 | tp_ops->input_data(drive, cmd, data, 2); |
88 | 88 | ||
89 | tf->data = data[0]; | 89 | cmd->tf.data = data[0]; |
90 | tf->hob_data = data[1]; | 90 | cmd->hob.data = data[1]; |
91 | } | 91 | } |
92 | 92 | ||
93 | tp_ops->tf_read(drive, cmd); | 93 | ide_tf_readback(drive, cmd); |
94 | 94 | ||
95 | if ((cmd->tf_flags & IDE_TFLAG_CUSTOM_HANDLER) && | 95 | if ((cmd->tf_flags & IDE_TFLAG_CUSTOM_HANDLER) && |
96 | tf_cmd == ATA_CMD_IDLEIMMEDIATE) { | 96 | tf_cmd == ATA_CMD_IDLEIMMEDIATE) { |
97 | if (tf->lbal != 0xc4) { | 97 | if (tf->lbal != 0xc4) { |
98 | printk(KERN_ERR "%s: head unload failed!\n", | 98 | printk(KERN_ERR "%s: head unload failed!\n", |
99 | drive->name); | 99 | drive->name); |
100 | ide_tf_dump(drive->name, tf); | 100 | ide_tf_dump(drive->name, cmd); |
101 | } else | 101 | } else |
102 | drive->dev_flags |= IDE_DFLAG_PARKED; | 102 | drive->dev_flags |= IDE_DFLAG_PARKED; |
103 | } | 103 | } |
@@ -205,8 +205,9 @@ static ide_startstop_t ide_disk_special(ide_drive_t *drive) | |||
205 | return ide_stopped; | 205 | return ide_stopped; |
206 | } | 206 | } |
207 | 207 | ||
208 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE | | 208 | cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; |
209 | IDE_TFLAG_CUSTOM_HANDLER; | 209 | cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; |
210 | cmd.tf_flags = IDE_TFLAG_CUSTOM_HANDLER; | ||
210 | 211 | ||
211 | do_rw_taskfile(drive, &cmd); | 212 | do_rw_taskfile(drive, &cmd); |
212 | 213 | ||
diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c index 770142767437..c1c25ebbaa1f 100644 --- a/drivers/ide/ide-ioctls.c +++ b/drivers/ide/ide-ioctls.c | |||
@@ -141,11 +141,12 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg) | |||
141 | tf->lbal = args[1]; | 141 | tf->lbal = args[1]; |
142 | tf->lbam = 0x4f; | 142 | tf->lbam = 0x4f; |
143 | tf->lbah = 0xc2; | 143 | tf->lbah = 0xc2; |
144 | cmd.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_IN_NSECT; | 144 | cmd.valid.out.tf = IDE_VALID_OUT_TF; |
145 | cmd.valid.in.tf = IDE_VALID_NSECT; | ||
145 | } else { | 146 | } else { |
146 | tf->nsect = args[1]; | 147 | tf->nsect = args[1]; |
147 | cmd.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT | | 148 | cmd.valid.out.tf = IDE_VALID_FEATURE | IDE_VALID_NSECT; |
148 | IDE_TFLAG_IN_NSECT; | 149 | cmd.valid.in.tf = IDE_VALID_NSECT; |
149 | } | 150 | } |
150 | tf->command = args[0]; | 151 | tf->command = args[0]; |
151 | cmd.protocol = args[3] ? ATA_PROT_PIO : ATA_PROT_NODATA; | 152 | cmd.protocol = args[3] ? ATA_PROT_PIO : ATA_PROT_NODATA; |
@@ -205,14 +206,15 @@ static int ide_task_ioctl(ide_drive_t *drive, unsigned long arg) | |||
205 | return -EFAULT; | 206 | return -EFAULT; |
206 | 207 | ||
207 | memset(&cmd, 0, sizeof(cmd)); | 208 | memset(&cmd, 0, sizeof(cmd)); |
208 | memcpy(&cmd.tf_array[7], &args[1], 6); | 209 | memcpy(&cmd.tf.feature, &args[1], 6); |
209 | cmd.tf.command = args[0]; | 210 | cmd.tf.command = args[0]; |
210 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 211 | cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; |
212 | cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; | ||
211 | 213 | ||
212 | err = ide_no_data_taskfile(drive, &cmd); | 214 | err = ide_no_data_taskfile(drive, &cmd); |
213 | 215 | ||
214 | args[0] = cmd.tf.command; | 216 | args[0] = cmd.tf.command; |
215 | memcpy(&args[1], &cmd.tf_array[7], 6); | 217 | memcpy(&args[1], &cmd.tf.feature, 6); |
216 | 218 | ||
217 | if (copy_to_user(p, args, 7)) | 219 | if (copy_to_user(p, args, 7)) |
218 | err = -EFAULT; | 220 | err = -EFAULT; |
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index 27bb70ddd459..c19a221b1e18 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -37,14 +37,11 @@ void SELECT_MASK(ide_drive_t *drive, int mask) | |||
37 | 37 | ||
38 | u8 ide_read_error(ide_drive_t *drive) | 38 | u8 ide_read_error(ide_drive_t *drive) |
39 | { | 39 | { |
40 | struct ide_cmd cmd; | 40 | struct ide_taskfile tf; |
41 | 41 | ||
42 | memset(&cmd, 0, sizeof(cmd)); | 42 | drive->hwif->tp_ops->tf_read(drive, &tf, IDE_VALID_ERROR); |
43 | cmd.tf_flags = IDE_TFLAG_IN_ERROR; | ||
44 | 43 | ||
45 | drive->hwif->tp_ops->tf_read(drive, &cmd); | 44 | return tf.error; |
46 | |||
47 | return cmd.tf.error; | ||
48 | } | 45 | } |
49 | EXPORT_SYMBOL_GPL(ide_read_error); | 46 | EXPORT_SYMBOL_GPL(ide_read_error); |
50 | 47 | ||
@@ -312,10 +309,10 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
312 | { | 309 | { |
313 | ide_hwif_t *hwif = drive->hwif; | 310 | ide_hwif_t *hwif = drive->hwif; |
314 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; | 311 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; |
312 | struct ide_taskfile tf; | ||
315 | u16 *id = drive->id, i; | 313 | u16 *id = drive->id, i; |
316 | int error = 0; | 314 | int error = 0; |
317 | u8 stat; | 315 | u8 stat; |
318 | struct ide_cmd cmd; | ||
319 | 316 | ||
320 | #ifdef CONFIG_BLK_DEV_IDEDMA | 317 | #ifdef CONFIG_BLK_DEV_IDEDMA |
321 | if (hwif->dma_ops) /* check if host supports DMA */ | 318 | if (hwif->dma_ops) /* check if host supports DMA */ |
@@ -347,12 +344,11 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
347 | udelay(1); | 344 | udelay(1); |
348 | tp_ops->write_devctl(hwif, ATA_NIEN | ATA_DEVCTL_OBS); | 345 | tp_ops->write_devctl(hwif, ATA_NIEN | ATA_DEVCTL_OBS); |
349 | 346 | ||
350 | memset(&cmd, 0, sizeof(cmd)); | 347 | memset(&tf, 0, sizeof(tf)); |
351 | cmd.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT; | 348 | tf.feature = SETFEATURES_XFER; |
352 | cmd.tf.feature = SETFEATURES_XFER; | 349 | tf.nsect = speed; |
353 | cmd.tf.nsect = speed; | ||
354 | 350 | ||
355 | tp_ops->tf_load(drive, &cmd); | 351 | tp_ops->tf_load(drive, &tf, IDE_VALID_FEATURE | IDE_VALID_NSECT); |
356 | 352 | ||
357 | tp_ops->exec_command(hwif, ATA_CMD_SET_FEATURES); | 353 | tp_ops->exec_command(hwif, ATA_CMD_SET_FEATURES); |
358 | 354 | ||
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index 217b7fdf2b17..56ff8c46c7d1 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -49,16 +49,17 @@ static void ide_dump_opcode(ide_drive_t *drive) | |||
49 | printk(KERN_CONT "0x%02x\n", cmd->tf.command); | 49 | printk(KERN_CONT "0x%02x\n", cmd->tf.command); |
50 | } | 50 | } |
51 | 51 | ||
52 | u64 ide_get_lba_addr(struct ide_taskfile *tf, int lba48) | 52 | u64 ide_get_lba_addr(struct ide_cmd *cmd, int lba48) |
53 | { | 53 | { |
54 | struct ide_taskfile *tf = &cmd->tf; | ||
54 | u32 high, low; | 55 | u32 high, low; |
55 | 56 | ||
56 | if (lba48) | ||
57 | high = (tf->hob_lbah << 16) | (tf->hob_lbam << 8) | | ||
58 | tf->hob_lbal; | ||
59 | else | ||
60 | high = tf->device & 0xf; | ||
61 | low = (tf->lbah << 16) | (tf->lbam << 8) | tf->lbal; | 57 | low = (tf->lbah << 16) | (tf->lbam << 8) | tf->lbal; |
58 | if (lba48) { | ||
59 | tf = &cmd->hob; | ||
60 | high = (tf->lbah << 16) | (tf->lbam << 8) | tf->lbal; | ||
61 | } else | ||
62 | high = tf->device & 0xf; | ||
62 | 63 | ||
63 | return ((u64)high << 24) | low; | 64 | return ((u64)high << 24) | low; |
64 | } | 65 | } |
@@ -71,17 +72,18 @@ static void ide_dump_sector(ide_drive_t *drive) | |||
71 | u8 lba48 = !!(drive->dev_flags & IDE_DFLAG_LBA48); | 72 | u8 lba48 = !!(drive->dev_flags & IDE_DFLAG_LBA48); |
72 | 73 | ||
73 | memset(&cmd, 0, sizeof(cmd)); | 74 | memset(&cmd, 0, sizeof(cmd)); |
74 | if (lba48) | 75 | if (lba48) { |
75 | cmd.tf_flags = IDE_TFLAG_IN_LBA | IDE_TFLAG_IN_HOB_LBA | | 76 | cmd.valid.in.tf = IDE_VALID_LBA; |
76 | IDE_TFLAG_LBA48; | 77 | cmd.valid.in.hob = IDE_VALID_LBA; |
77 | else | 78 | cmd.tf_flags = IDE_TFLAG_LBA48; |
78 | cmd.tf_flags = IDE_TFLAG_IN_LBA | IDE_TFLAG_IN_DEVICE; | 79 | } else |
80 | cmd.valid.in.tf = IDE_VALID_LBA | IDE_VALID_DEVICE; | ||
79 | 81 | ||
80 | drive->hwif->tp_ops->tf_read(drive, &cmd); | 82 | ide_tf_readback(drive, &cmd); |
81 | 83 | ||
82 | if (lba48 || (tf->device & ATA_LBA)) | 84 | if (lba48 || (tf->device & ATA_LBA)) |
83 | printk(KERN_CONT ", LBAsect=%llu", | 85 | printk(KERN_CONT ", LBAsect=%llu", |
84 | (unsigned long long)ide_get_lba_addr(tf, lba48)); | 86 | (unsigned long long)ide_get_lba_addr(&cmd, lba48)); |
85 | else | 87 | else |
86 | printk(KERN_CONT ", CHS=%d/%d/%d", (tf->lbah << 8) + tf->lbam, | 88 | printk(KERN_CONT ", CHS=%d/%d/%d", (tf->lbah << 8) + tf->lbam, |
87 | tf->device & 0xf, tf->lbal); | 89 | tf->device & 0xf, tf->lbal); |
diff --git a/drivers/ide/ide-park.c b/drivers/ide/ide-park.c index 9490b446519f..310d03f2b5b7 100644 --- a/drivers/ide/ide-park.c +++ b/drivers/ide/ide-park.c | |||
@@ -74,7 +74,8 @@ ide_startstop_t ide_do_park_unpark(ide_drive_t *drive, struct request *rq) | |||
74 | tf->lbal = 0x4c; | 74 | tf->lbal = 0x4c; |
75 | tf->lbam = 0x4e; | 75 | tf->lbam = 0x4e; |
76 | tf->lbah = 0x55; | 76 | tf->lbah = 0x55; |
77 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 77 | cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; |
78 | cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; | ||
78 | } else /* cmd == REQ_UNPARK_HEADS */ | 79 | } else /* cmd == REQ_UNPARK_HEADS */ |
79 | tf->command = ATA_CMD_CHK_POWER; | 80 | tf->command = ATA_CMD_CHK_POWER; |
80 | 81 | ||
diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c index bb7858ebb7d1..0d8a151c0a01 100644 --- a/drivers/ide/ide-pm.c +++ b/drivers/ide/ide-pm.c | |||
@@ -163,7 +163,8 @@ ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq) | |||
163 | return ide_stopped; | 163 | return ide_stopped; |
164 | 164 | ||
165 | out_do_tf: | 165 | out_do_tf: |
166 | cmd->tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 166 | cmd->valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; |
167 | cmd->valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; | ||
167 | cmd->protocol = ATA_PROT_NODATA; | 168 | cmd->protocol = ATA_PROT_NODATA; |
168 | 169 | ||
169 | return do_rw_taskfile(drive, cmd); | 170 | return do_rw_taskfile(drive, cmd); |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index d8c1c3e735bb..7f264ed1141b 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -283,13 +283,11 @@ int ide_dev_read_id(ide_drive_t *drive, u8 cmd, u16 *id) | |||
283 | * identify command to be sure of reply | 283 | * identify command to be sure of reply |
284 | */ | 284 | */ |
285 | if (cmd == ATA_CMD_ID_ATAPI) { | 285 | if (cmd == ATA_CMD_ID_ATAPI) { |
286 | struct ide_cmd cmd; | 286 | struct ide_taskfile tf; |
287 | 287 | ||
288 | memset(&cmd, 0, sizeof(cmd)); | 288 | memset(&tf, 0, sizeof(tf)); |
289 | /* disable DMA & overlap */ | 289 | /* disable DMA & overlap */ |
290 | cmd.tf_flags = IDE_TFLAG_OUT_FEATURE; | 290 | tp_ops->tf_load(drive, &tf, IDE_VALID_FEATURE); |
291 | |||
292 | tp_ops->tf_load(drive, &cmd); | ||
293 | } | 291 | } |
294 | 292 | ||
295 | /* ask drive for ID */ | 293 | /* ask drive for ID */ |
@@ -337,14 +335,11 @@ int ide_busy_sleep(ide_hwif_t *hwif, unsigned long timeout, int altstatus) | |||
337 | 335 | ||
338 | static u8 ide_read_device(ide_drive_t *drive) | 336 | static u8 ide_read_device(ide_drive_t *drive) |
339 | { | 337 | { |
340 | struct ide_cmd cmd; | 338 | struct ide_taskfile tf; |
341 | |||
342 | memset(&cmd, 0, sizeof(cmd)); | ||
343 | cmd.tf_flags = IDE_TFLAG_IN_DEVICE; | ||
344 | 339 | ||
345 | drive->hwif->tp_ops->tf_read(drive, &cmd); | 340 | drive->hwif->tp_ops->tf_read(drive, &tf, IDE_VALID_DEVICE); |
346 | 341 | ||
347 | return cmd.tf.device; | 342 | return tf.device; |
348 | } | 343 | } |
349 | 344 | ||
350 | /** | 345 | /** |
@@ -1314,6 +1309,7 @@ struct ide_host *ide_host_alloc(const struct ide_port_info *d, hw_regs_t **hws) | |||
1314 | host->get_lock = d->get_lock; | 1309 | host->get_lock = d->get_lock; |
1315 | host->release_lock = d->release_lock; | 1310 | host->release_lock = d->release_lock; |
1316 | host->host_flags = d->host_flags; | 1311 | host->host_flags = d->host_flags; |
1312 | host->irq_flags = d->irq_flags; | ||
1317 | } | 1313 | } |
1318 | 1314 | ||
1319 | return host; | 1315 | return host; |
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index 10a88bf3eefa..3242698832a4 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c | |||
@@ -204,8 +204,8 @@ static int set_xfer_rate (ide_drive_t *drive, int arg) | |||
204 | cmd.tf.command = ATA_CMD_SET_FEATURES; | 204 | cmd.tf.command = ATA_CMD_SET_FEATURES; |
205 | cmd.tf.feature = SETFEATURES_XFER; | 205 | cmd.tf.feature = SETFEATURES_XFER; |
206 | cmd.tf.nsect = (u8)arg; | 206 | cmd.tf.nsect = (u8)arg; |
207 | cmd.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT | | 207 | cmd.valid.out.tf = IDE_VALID_FEATURE | IDE_VALID_NSECT; |
208 | IDE_TFLAG_IN_NSECT; | 208 | cmd.valid.in.tf = IDE_VALID_NSECT; |
209 | 209 | ||
210 | err = ide_no_data_taskfile(drive, &cmd); | 210 | err = ide_no_data_taskfile(drive, &cmd); |
211 | 211 | ||
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 243421ce40d0..4aa6223c11be 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -23,17 +23,33 @@ | |||
23 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
24 | #include <asm/io.h> | 24 | #include <asm/io.h> |
25 | 25 | ||
26 | void ide_tf_dump(const char *s, struct ide_taskfile *tf) | 26 | void ide_tf_readback(ide_drive_t *drive, struct ide_cmd *cmd) |
27 | { | ||
28 | ide_hwif_t *hwif = drive->hwif; | ||
29 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; | ||
30 | |||
31 | /* Be sure we're looking at the low order bytes */ | ||
32 | tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS); | ||
33 | |||
34 | tp_ops->tf_read(drive, &cmd->tf, cmd->valid.in.tf); | ||
35 | |||
36 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { | ||
37 | tp_ops->write_devctl(hwif, ATA_HOB | ATA_DEVCTL_OBS); | ||
38 | |||
39 | tp_ops->tf_read(drive, &cmd->hob, cmd->valid.in.hob); | ||
40 | } | ||
41 | } | ||
42 | |||
43 | void ide_tf_dump(const char *s, struct ide_cmd *cmd) | ||
27 | { | 44 | { |
28 | #ifdef DEBUG | 45 | #ifdef DEBUG |
29 | printk("%s: tf: feat 0x%02x nsect 0x%02x lbal 0x%02x " | 46 | printk("%s: tf: feat 0x%02x nsect 0x%02x lbal 0x%02x " |
30 | "lbam 0x%02x lbah 0x%02x dev 0x%02x cmd 0x%02x\n", | 47 | "lbam 0x%02x lbah 0x%02x dev 0x%02x cmd 0x%02x\n", |
31 | s, tf->feature, tf->nsect, tf->lbal, | 48 | s, cmd->tf.feature, cmd->tf.nsect, |
32 | tf->lbam, tf->lbah, tf->device, tf->command); | 49 | cmd->tf.lbal, cmd->tf.lbam, cmd->tf.lbah, |
33 | printk("%s: hob: nsect 0x%02x lbal 0x%02x " | 50 | cmd->tf.device, cmd->tf.command); |
34 | "lbam 0x%02x lbah 0x%02x\n", | 51 | printk("%s: hob: nsect 0x%02x lbal 0x%02x lbam 0x%02x lbah 0x%02x\n", |
35 | s, tf->hob_nsect, tf->hob_lbal, | 52 | s, cmd->hob.nsect, cmd->hob.lbal, cmd->hob.lbam, cmd->hob.lbah); |
36 | tf->hob_lbam, tf->hob_lbah); | ||
37 | #endif | 53 | #endif |
38 | } | 54 | } |
39 | 55 | ||
@@ -47,7 +63,8 @@ int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf) | |||
47 | cmd.tf.command = ATA_CMD_ID_ATA; | 63 | cmd.tf.command = ATA_CMD_ID_ATA; |
48 | else | 64 | else |
49 | cmd.tf.command = ATA_CMD_ID_ATAPI; | 65 | cmd.tf.command = ATA_CMD_ID_ATAPI; |
50 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 66 | cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE; |
67 | cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE; | ||
51 | cmd.protocol = ATA_PROT_PIO; | 68 | cmd.protocol = ATA_PROT_PIO; |
52 | 69 | ||
53 | return ide_raw_taskfile(drive, &cmd, buf, 1); | 70 | return ide_raw_taskfile(drive, &cmd, buf, 1); |
@@ -79,16 +96,27 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd) | |||
79 | memcpy(cmd, orig_cmd, sizeof(*cmd)); | 96 | memcpy(cmd, orig_cmd, sizeof(*cmd)); |
80 | 97 | ||
81 | if ((cmd->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) { | 98 | if ((cmd->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) { |
82 | ide_tf_dump(drive->name, tf); | 99 | ide_tf_dump(drive->name, cmd); |
83 | tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS); | 100 | tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS); |
84 | SELECT_MASK(drive, 0); | 101 | SELECT_MASK(drive, 0); |
85 | 102 | ||
86 | if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) { | 103 | if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) { |
87 | u8 data[2] = { tf->data, tf->hob_data }; | 104 | u8 data[2] = { cmd->tf.data, cmd->hob.data }; |
88 | 105 | ||
89 | tp_ops->output_data(drive, cmd, data, 2); | 106 | tp_ops->output_data(drive, cmd, data, 2); |
90 | } | 107 | } |
91 | tp_ops->tf_load(drive, cmd); | 108 | |
109 | if (cmd->valid.out.tf & IDE_VALID_DEVICE) { | ||
110 | u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? | ||
111 | 0xE0 : 0xEF; | ||
112 | |||
113 | if (!(cmd->ftf_flags & IDE_FTFLAG_FLAGGED)) | ||
114 | cmd->tf.device &= HIHI; | ||
115 | cmd->tf.device |= drive->select; | ||
116 | } | ||
117 | |||
118 | tp_ops->tf_load(drive, &cmd->hob, cmd->valid.out.hob); | ||
119 | tp_ops->tf_load(drive, &cmd->tf, cmd->valid.out.tf); | ||
92 | } | 120 | } |
93 | 121 | ||
94 | switch (cmd->protocol) { | 122 | switch (cmd->protocol) { |
@@ -489,16 +517,17 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg) | |||
489 | 517 | ||
490 | memset(&cmd, 0, sizeof(cmd)); | 518 | memset(&cmd, 0, sizeof(cmd)); |
491 | 519 | ||
492 | memcpy(&cmd.tf_array[0], req_task->hob_ports, | 520 | memcpy(&cmd.hob, req_task->hob_ports, HDIO_DRIVE_HOB_HDR_SIZE - 2); |
493 | HDIO_DRIVE_HOB_HDR_SIZE - 2); | 521 | memcpy(&cmd.tf, req_task->io_ports, HDIO_DRIVE_TASK_HDR_SIZE); |
494 | memcpy(&cmd.tf_array[6], req_task->io_ports, | ||
495 | HDIO_DRIVE_TASK_HDR_SIZE); | ||
496 | 522 | ||
497 | cmd.tf_flags = IDE_TFLAG_IO_16BIT | IDE_TFLAG_DEVICE | | 523 | cmd.valid.out.tf = IDE_VALID_DEVICE; |
498 | IDE_TFLAG_IN_TF; | 524 | cmd.valid.in.tf = IDE_VALID_DEVICE | IDE_VALID_IN_TF; |
525 | cmd.tf_flags = IDE_TFLAG_IO_16BIT; | ||
499 | 526 | ||
500 | if (drive->dev_flags & IDE_DFLAG_LBA48) | 527 | if (drive->dev_flags & IDE_DFLAG_LBA48) { |
501 | cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_IN_HOB); | 528 | cmd.tf_flags |= IDE_TFLAG_LBA48; |
529 | cmd.valid.in.hob = IDE_VALID_IN_HOB; | ||
530 | } | ||
502 | 531 | ||
503 | if (req_task->out_flags.all) { | 532 | if (req_task->out_flags.all) { |
504 | cmd.ftf_flags |= IDE_FTFLAG_FLAGGED; | 533 | cmd.ftf_flags |= IDE_FTFLAG_FLAGGED; |
@@ -507,28 +536,28 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg) | |||
507 | cmd.ftf_flags |= IDE_FTFLAG_OUT_DATA; | 536 | cmd.ftf_flags |= IDE_FTFLAG_OUT_DATA; |
508 | 537 | ||
509 | if (req_task->out_flags.b.nsector_hob) | 538 | if (req_task->out_flags.b.nsector_hob) |
510 | cmd.tf_flags |= IDE_TFLAG_OUT_HOB_NSECT; | 539 | cmd.valid.out.hob |= IDE_VALID_NSECT; |
511 | if (req_task->out_flags.b.sector_hob) | 540 | if (req_task->out_flags.b.sector_hob) |
512 | cmd.tf_flags |= IDE_TFLAG_OUT_HOB_LBAL; | 541 | cmd.valid.out.hob |= IDE_VALID_LBAL; |
513 | if (req_task->out_flags.b.lcyl_hob) | 542 | if (req_task->out_flags.b.lcyl_hob) |
514 | cmd.tf_flags |= IDE_TFLAG_OUT_HOB_LBAM; | 543 | cmd.valid.out.hob |= IDE_VALID_LBAM; |
515 | if (req_task->out_flags.b.hcyl_hob) | 544 | if (req_task->out_flags.b.hcyl_hob) |
516 | cmd.tf_flags |= IDE_TFLAG_OUT_HOB_LBAH; | 545 | cmd.valid.out.hob |= IDE_VALID_LBAH; |
517 | 546 | ||
518 | if (req_task->out_flags.b.error_feature) | 547 | if (req_task->out_flags.b.error_feature) |
519 | cmd.tf_flags |= IDE_TFLAG_OUT_FEATURE; | 548 | cmd.valid.out.tf |= IDE_VALID_FEATURE; |
520 | if (req_task->out_flags.b.nsector) | 549 | if (req_task->out_flags.b.nsector) |
521 | cmd.tf_flags |= IDE_TFLAG_OUT_NSECT; | 550 | cmd.valid.out.tf |= IDE_VALID_NSECT; |
522 | if (req_task->out_flags.b.sector) | 551 | if (req_task->out_flags.b.sector) |
523 | cmd.tf_flags |= IDE_TFLAG_OUT_LBAL; | 552 | cmd.valid.out.tf |= IDE_VALID_LBAL; |
524 | if (req_task->out_flags.b.lcyl) | 553 | if (req_task->out_flags.b.lcyl) |
525 | cmd.tf_flags |= IDE_TFLAG_OUT_LBAM; | 554 | cmd.valid.out.tf |= IDE_VALID_LBAM; |
526 | if (req_task->out_flags.b.hcyl) | 555 | if (req_task->out_flags.b.hcyl) |
527 | cmd.tf_flags |= IDE_TFLAG_OUT_LBAH; | 556 | cmd.valid.out.tf |= IDE_VALID_LBAH; |
528 | } else { | 557 | } else { |
529 | cmd.tf_flags |= IDE_TFLAG_OUT_TF; | 558 | cmd.valid.out.tf |= IDE_VALID_OUT_TF; |
530 | if (cmd.tf_flags & IDE_TFLAG_LBA48) | 559 | if (cmd.tf_flags & IDE_TFLAG_LBA48) |
531 | cmd.tf_flags |= IDE_TFLAG_OUT_HOB; | 560 | cmd.valid.out.hob |= IDE_VALID_OUT_HOB; |
532 | } | 561 | } |
533 | 562 | ||
534 | if (req_task->in_flags.b.data) | 563 | if (req_task->in_flags.b.data) |
@@ -594,7 +623,7 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg) | |||
594 | if (req_task->req_cmd == IDE_DRIVE_TASK_NO_DATA) | 623 | if (req_task->req_cmd == IDE_DRIVE_TASK_NO_DATA) |
595 | nsect = 0; | 624 | nsect = 0; |
596 | else if (!nsect) { | 625 | else if (!nsect) { |
597 | nsect = (cmd.tf.hob_nsect << 8) | cmd.tf.nsect; | 626 | nsect = (cmd.hob.nsect << 8) | cmd.tf.nsect; |
598 | 627 | ||
599 | if (!nsect) { | 628 | if (!nsect) { |
600 | printk(KERN_ERR "%s: in/out command without data\n", | 629 | printk(KERN_ERR "%s: in/out command without data\n", |
@@ -606,10 +635,8 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg) | |||
606 | 635 | ||
607 | err = ide_raw_taskfile(drive, &cmd, data_buf, nsect); | 636 | err = ide_raw_taskfile(drive, &cmd, data_buf, nsect); |
608 | 637 | ||
609 | memcpy(req_task->hob_ports, &cmd.tf_array[0], | 638 | memcpy(req_task->hob_ports, &cmd.hob, HDIO_DRIVE_HOB_HDR_SIZE - 2); |
610 | HDIO_DRIVE_HOB_HDR_SIZE - 2); | 639 | memcpy(req_task->io_ports, &cmd.tf, HDIO_DRIVE_TASK_HDR_SIZE); |
611 | memcpy(req_task->io_ports, &cmd.tf_array[6], | ||
612 | HDIO_DRIVE_TASK_HDR_SIZE); | ||
613 | 640 | ||
614 | if ((cmd.ftf_flags & IDE_FTFLAG_SET_IN_FLAGS) && | 641 | if ((cmd.ftf_flags & IDE_FTFLAG_SET_IN_FLAGS) && |
615 | req_task->in_flags.all == 0) { | 642 | req_task->in_flags.all == 0) { |
diff --git a/drivers/ide/ns87415.c b/drivers/ide/ns87415.c index 71a39fb3856f..95327a2c2422 100644 --- a/drivers/ide/ns87415.c +++ b/drivers/ide/ns87415.c | |||
@@ -61,41 +61,23 @@ static u8 superio_dma_sff_read_status(ide_hwif_t *hwif) | |||
61 | return superio_ide_inb(hwif->dma_base + ATA_DMA_STATUS); | 61 | return superio_ide_inb(hwif->dma_base + ATA_DMA_STATUS); |
62 | } | 62 | } |
63 | 63 | ||
64 | static void superio_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) | 64 | static void superio_tf_read(ide_drive_t *drive, struct ide_taskfile *tf, |
65 | u8 valid) | ||
65 | { | 66 | { |
66 | struct ide_io_ports *io_ports = &drive->hwif->io_ports; | 67 | struct ide_io_ports *io_ports = &drive->hwif->io_ports; |
67 | struct ide_taskfile *tf = &cmd->tf; | ||
68 | 68 | ||
69 | /* be sure we're looking at the low order bits */ | 69 | if (valid & IDE_VALID_ERROR) |
70 | outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); | ||
71 | |||
72 | if (cmd->tf_flags & IDE_TFLAG_IN_ERROR) | ||
73 | tf->error = inb(io_ports->feature_addr); | 70 | tf->error = inb(io_ports->feature_addr); |
74 | if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) | 71 | if (valid & IDE_VALID_NSECT) |
75 | tf->nsect = inb(io_ports->nsect_addr); | 72 | tf->nsect = inb(io_ports->nsect_addr); |
76 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) | 73 | if (valid & IDE_VALID_LBAL) |
77 | tf->lbal = inb(io_ports->lbal_addr); | 74 | tf->lbal = inb(io_ports->lbal_addr); |
78 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) | 75 | if (valid & IDE_VALID_LBAM) |
79 | tf->lbam = inb(io_ports->lbam_addr); | 76 | tf->lbam = inb(io_ports->lbam_addr); |
80 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) | 77 | if (valid & IDE_VALID_LBAH) |
81 | tf->lbah = inb(io_ports->lbah_addr); | 78 | tf->lbah = inb(io_ports->lbah_addr); |
82 | if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) | 79 | if (valid & IDE_VALID_DEVICE) |
83 | tf->device = superio_ide_inb(io_ports->device_addr); | 80 | tf->device = superio_ide_inb(io_ports->device_addr); |
84 | |||
85 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { | ||
86 | outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr); | ||
87 | |||
88 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_ERROR) | ||
89 | tf->hob_error = inb(io_ports->feature_addr); | ||
90 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) | ||
91 | tf->hob_nsect = inb(io_ports->nsect_addr); | ||
92 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) | ||
93 | tf->hob_lbal = inb(io_ports->lbal_addr); | ||
94 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) | ||
95 | tf->hob_lbam = inb(io_ports->lbam_addr); | ||
96 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) | ||
97 | tf->hob_lbah = inb(io_ports->lbah_addr); | ||
98 | } | ||
99 | } | 81 | } |
100 | 82 | ||
101 | static void ns87415_dev_select(ide_drive_t *drive); | 83 | static void ns87415_dev_select(ide_drive_t *drive); |
diff --git a/drivers/ide/q40ide.c b/drivers/ide/q40ide.c index d007e7f66598..c79346679244 100644 --- a/drivers/ide/q40ide.c +++ b/drivers/ide/q40ide.c | |||
@@ -16,6 +16,8 @@ | |||
16 | #include <linux/blkdev.h> | 16 | #include <linux/blkdev.h> |
17 | #include <linux/ide.h> | 17 | #include <linux/ide.h> |
18 | 18 | ||
19 | #include <asm/ide.h> | ||
20 | |||
19 | /* | 21 | /* |
20 | * Bases of the IDE interfaces | 22 | * Bases of the IDE interfaces |
21 | */ | 23 | */ |
@@ -77,8 +79,10 @@ static void q40ide_input_data(ide_drive_t *drive, struct ide_cmd *cmd, | |||
77 | { | 79 | { |
78 | unsigned long data_addr = drive->hwif->io_ports.data_addr; | 80 | unsigned long data_addr = drive->hwif->io_ports.data_addr; |
79 | 81 | ||
80 | if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS)) | 82 | if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS)) { |
81 | return insw(data_addr, buf, (len + 1) / 2); | 83 | __ide_mm_insw(data_addr, buf, (len + 1) / 2); |
84 | return; | ||
85 | } | ||
82 | 86 | ||
83 | raw_insw_swapw((u16 *)data_addr, buf, (len + 1) / 2); | 87 | raw_insw_swapw((u16 *)data_addr, buf, (len + 1) / 2); |
84 | } | 88 | } |
@@ -88,8 +92,10 @@ static void q40ide_output_data(ide_drive_t *drive, struct ide_cmd *cmd, | |||
88 | { | 92 | { |
89 | unsigned long data_addr = drive->hwif->io_ports.data_addr; | 93 | unsigned long data_addr = drive->hwif->io_ports.data_addr; |
90 | 94 | ||
91 | if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS)) | 95 | if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS)) { |
92 | return outsw(data_addr, buf, (len + 1) / 2); | 96 | __ide_mm_outsw(data_addr, buf, (len + 1) / 2); |
97 | return; | ||
98 | } | ||
93 | 99 | ||
94 | raw_outsw_swapw((u16 *)data_addr, buf, (len + 1) / 2); | 100 | raw_outsw_swapw((u16 *)data_addr, buf, (len + 1) / 2); |
95 | } | 101 | } |
diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c index 6d8dbd9c10bc..5be41f25204f 100644 --- a/drivers/ide/scc_pata.c +++ b/drivers/ide/scc_pata.c | |||
@@ -337,7 +337,6 @@ static void scc_dma_start(ide_drive_t *drive) | |||
337 | 337 | ||
338 | /* start DMA */ | 338 | /* start DMA */ |
339 | scc_ide_outb(dma_cmd | 1, hwif->dma_base); | 339 | scc_ide_outb(dma_cmd | 1, hwif->dma_base); |
340 | wmb(); | ||
341 | } | 340 | } |
342 | 341 | ||
343 | static int __scc_dma_end(ide_drive_t *drive) | 342 | static int __scc_dma_end(ide_drive_t *drive) |
@@ -354,7 +353,6 @@ static int __scc_dma_end(ide_drive_t *drive) | |||
354 | /* clear the INTR & ERROR bits */ | 353 | /* clear the INTR & ERROR bits */ |
355 | scc_ide_outb(dma_stat | 6, hwif->dma_base + 4); | 354 | scc_ide_outb(dma_stat | 6, hwif->dma_base + 4); |
356 | /* verify good DMA status */ | 355 | /* verify good DMA status */ |
357 | wmb(); | ||
358 | return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0; | 356 | return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0; |
359 | } | 357 | } |
360 | 358 | ||
@@ -647,77 +645,40 @@ static int __devinit init_setup_scc(struct pci_dev *dev, | |||
647 | return rc; | 645 | return rc; |
648 | } | 646 | } |
649 | 647 | ||
650 | static void scc_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) | 648 | static void scc_tf_load(ide_drive_t *drive, struct ide_taskfile *tf, u8 valid) |
651 | { | 649 | { |
652 | struct ide_io_ports *io_ports = &drive->hwif->io_ports; | 650 | struct ide_io_ports *io_ports = &drive->hwif->io_ports; |
653 | struct ide_taskfile *tf = &cmd->tf; | 651 | |
654 | u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; | 652 | if (valid & IDE_VALID_FEATURE) |
655 | |||
656 | if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) | ||
657 | HIHI = 0xFF; | ||
658 | |||
659 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) | ||
660 | scc_ide_outb(tf->hob_feature, io_ports->feature_addr); | ||
661 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) | ||
662 | scc_ide_outb(tf->hob_nsect, io_ports->nsect_addr); | ||
663 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) | ||
664 | scc_ide_outb(tf->hob_lbal, io_ports->lbal_addr); | ||
665 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) | ||
666 | scc_ide_outb(tf->hob_lbam, io_ports->lbam_addr); | ||
667 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) | ||
668 | scc_ide_outb(tf->hob_lbah, io_ports->lbah_addr); | ||
669 | |||
670 | if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) | ||
671 | scc_ide_outb(tf->feature, io_ports->feature_addr); | 653 | scc_ide_outb(tf->feature, io_ports->feature_addr); |
672 | if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) | 654 | if (valid & IDE_VALID_NSECT) |
673 | scc_ide_outb(tf->nsect, io_ports->nsect_addr); | 655 | scc_ide_outb(tf->nsect, io_ports->nsect_addr); |
674 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) | 656 | if (valid & IDE_VALID_LBAL) |
675 | scc_ide_outb(tf->lbal, io_ports->lbal_addr); | 657 | scc_ide_outb(tf->lbal, io_ports->lbal_addr); |
676 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) | 658 | if (valid & IDE_VALID_LBAM) |
677 | scc_ide_outb(tf->lbam, io_ports->lbam_addr); | 659 | scc_ide_outb(tf->lbam, io_ports->lbam_addr); |
678 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) | 660 | if (valid & IDE_VALID_LBAH) |
679 | scc_ide_outb(tf->lbah, io_ports->lbah_addr); | 661 | scc_ide_outb(tf->lbah, io_ports->lbah_addr); |
680 | 662 | if (valid & IDE_VALID_DEVICE) | |
681 | if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) | 663 | scc_ide_outb(tf->device, io_ports->device_addr); |
682 | scc_ide_outb((tf->device & HIHI) | drive->select, | ||
683 | io_ports->device_addr); | ||
684 | } | 664 | } |
685 | 665 | ||
686 | static void scc_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) | 666 | static void scc_tf_read(ide_drive_t *drive, struct ide_taskfile *tf, u8 valid) |
687 | { | 667 | { |
688 | struct ide_io_ports *io_ports = &drive->hwif->io_ports; | 668 | struct ide_io_ports *io_ports = &drive->hwif->io_ports; |
689 | struct ide_taskfile *tf = &cmd->tf; | ||
690 | |||
691 | /* be sure we're looking at the low order bits */ | ||
692 | scc_ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); | ||
693 | 669 | ||
694 | if (cmd->tf_flags & IDE_TFLAG_IN_ERROR) | 670 | if (valid & IDE_VALID_ERROR) |
695 | tf->error = scc_ide_inb(io_ports->feature_addr); | 671 | tf->error = scc_ide_inb(io_ports->feature_addr); |
696 | if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) | 672 | if (valid & IDE_VALID_NSECT) |
697 | tf->nsect = scc_ide_inb(io_ports->nsect_addr); | 673 | tf->nsect = scc_ide_inb(io_ports->nsect_addr); |
698 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) | 674 | if (valid & IDE_VALID_LBAL) |
699 | tf->lbal = scc_ide_inb(io_ports->lbal_addr); | 675 | tf->lbal = scc_ide_inb(io_ports->lbal_addr); |
700 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) | 676 | if (valid & IDE_VALID_LBAM) |
701 | tf->lbam = scc_ide_inb(io_ports->lbam_addr); | 677 | tf->lbam = scc_ide_inb(io_ports->lbam_addr); |
702 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) | 678 | if (valid & IDE_VALID_LBAH) |
703 | tf->lbah = scc_ide_inb(io_ports->lbah_addr); | 679 | tf->lbah = scc_ide_inb(io_ports->lbah_addr); |
704 | if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) | 680 | if (valid & IDE_VALID_DEVICE) |
705 | tf->device = scc_ide_inb(io_ports->device_addr); | 681 | tf->device = scc_ide_inb(io_ports->device_addr); |
706 | |||
707 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { | ||
708 | scc_ide_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr); | ||
709 | |||
710 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_ERROR) | ||
711 | tf->hob_error = scc_ide_inb(io_ports->feature_addr); | ||
712 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) | ||
713 | tf->hob_nsect = scc_ide_inb(io_ports->nsect_addr); | ||
714 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) | ||
715 | tf->hob_lbal = scc_ide_inb(io_ports->lbal_addr); | ||
716 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) | ||
717 | tf->hob_lbam = scc_ide_inb(io_ports->lbam_addr); | ||
718 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) | ||
719 | tf->hob_lbah = scc_ide_inb(io_ports->lbah_addr); | ||
720 | } | ||
721 | } | 682 | } |
722 | 683 | ||
723 | static void scc_input_data(ide_drive_t *drive, struct ide_cmd *cmd, | 684 | static void scc_input_data(ide_drive_t *drive, struct ide_cmd *cmd, |
diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c index 4cb79c4c2604..e33d764e2945 100644 --- a/drivers/ide/tx4938ide.c +++ b/drivers/ide/tx4938ide.c | |||
@@ -72,91 +72,6 @@ static void tx4938ide_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
72 | #ifdef __BIG_ENDIAN | 72 | #ifdef __BIG_ENDIAN |
73 | 73 | ||
74 | /* custom iops (independent from SWAP_IO_SPACE) */ | 74 | /* custom iops (independent from SWAP_IO_SPACE) */ |
75 | static u8 tx4938ide_inb(unsigned long port) | ||
76 | { | ||
77 | return __raw_readb((void __iomem *)port); | ||
78 | } | ||
79 | |||
80 | static void tx4938ide_outb(u8 value, unsigned long port) | ||
81 | { | ||
82 | __raw_writeb(value, (void __iomem *)port); | ||
83 | } | ||
84 | |||
85 | static void tx4938ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) | ||
86 | { | ||
87 | ide_hwif_t *hwif = drive->hwif; | ||
88 | struct ide_io_ports *io_ports = &hwif->io_ports; | ||
89 | struct ide_taskfile *tf = &cmd->tf; | ||
90 | u8 HIHI = cmd->tf_flags & IDE_TFLAG_LBA48 ? 0xE0 : 0xEF; | ||
91 | |||
92 | if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) | ||
93 | HIHI = 0xFF; | ||
94 | |||
95 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) | ||
96 | tx4938ide_outb(tf->hob_feature, io_ports->feature_addr); | ||
97 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) | ||
98 | tx4938ide_outb(tf->hob_nsect, io_ports->nsect_addr); | ||
99 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) | ||
100 | tx4938ide_outb(tf->hob_lbal, io_ports->lbal_addr); | ||
101 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) | ||
102 | tx4938ide_outb(tf->hob_lbam, io_ports->lbam_addr); | ||
103 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) | ||
104 | tx4938ide_outb(tf->hob_lbah, io_ports->lbah_addr); | ||
105 | |||
106 | if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) | ||
107 | tx4938ide_outb(tf->feature, io_ports->feature_addr); | ||
108 | if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) | ||
109 | tx4938ide_outb(tf->nsect, io_ports->nsect_addr); | ||
110 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) | ||
111 | tx4938ide_outb(tf->lbal, io_ports->lbal_addr); | ||
112 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) | ||
113 | tx4938ide_outb(tf->lbam, io_ports->lbam_addr); | ||
114 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) | ||
115 | tx4938ide_outb(tf->lbah, io_ports->lbah_addr); | ||
116 | |||
117 | if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) | ||
118 | tx4938ide_outb((tf->device & HIHI) | drive->select, | ||
119 | io_ports->device_addr); | ||
120 | } | ||
121 | |||
122 | static void tx4938ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) | ||
123 | { | ||
124 | ide_hwif_t *hwif = drive->hwif; | ||
125 | struct ide_io_ports *io_ports = &hwif->io_ports; | ||
126 | struct ide_taskfile *tf = &cmd->tf; | ||
127 | |||
128 | /* be sure we're looking at the low order bits */ | ||
129 | tx4938ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); | ||
130 | |||
131 | if (cmd->tf_flags & IDE_TFLAG_IN_ERROR) | ||
132 | tf->error = tx4938ide_inb(io_ports->feature_addr); | ||
133 | if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) | ||
134 | tf->nsect = tx4938ide_inb(io_ports->nsect_addr); | ||
135 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) | ||
136 | tf->lbal = tx4938ide_inb(io_ports->lbal_addr); | ||
137 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) | ||
138 | tf->lbam = tx4938ide_inb(io_ports->lbam_addr); | ||
139 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) | ||
140 | tf->lbah = tx4938ide_inb(io_ports->lbah_addr); | ||
141 | if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) | ||
142 | tf->device = tx4938ide_inb(io_ports->device_addr); | ||
143 | |||
144 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { | ||
145 | tx4938ide_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr); | ||
146 | |||
147 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_ERROR) | ||
148 | tf->hob_error = tx4938ide_inb(io_ports->feature_addr); | ||
149 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) | ||
150 | tf->hob_nsect = tx4938ide_inb(io_ports->nsect_addr); | ||
151 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) | ||
152 | tf->hob_lbal = tx4938ide_inb(io_ports->lbal_addr); | ||
153 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) | ||
154 | tf->hob_lbam = tx4938ide_inb(io_ports->lbam_addr); | ||
155 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) | ||
156 | tf->hob_lbah = tx4938ide_inb(io_ports->lbah_addr); | ||
157 | } | ||
158 | } | ||
159 | |||
160 | static void tx4938ide_input_data_swap(ide_drive_t *drive, struct ide_cmd *cmd, | 75 | static void tx4938ide_input_data_swap(ide_drive_t *drive, struct ide_cmd *cmd, |
161 | void *buf, unsigned int len) | 76 | void *buf, unsigned int len) |
162 | { | 77 | { |
@@ -190,8 +105,8 @@ static const struct ide_tp_ops tx4938ide_tp_ops = { | |||
190 | .write_devctl = ide_write_devctl, | 105 | .write_devctl = ide_write_devctl, |
191 | 106 | ||
192 | .dev_select = ide_dev_select, | 107 | .dev_select = ide_dev_select, |
193 | .tf_load = tx4938ide_tf_load, | 108 | .tf_load = ide_tf_load, |
194 | .tf_read = tx4938ide_tf_read, | 109 | .tf_read = ide_tf_read, |
195 | 110 | ||
196 | .input_data = tx4938ide_input_data_swap, | 111 | .input_data = tx4938ide_input_data_swap, |
197 | .output_data = tx4938ide_output_data_swap, | 112 | .output_data = tx4938ide_output_data_swap, |
diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c index 0040a9a3e26e..564422d23976 100644 --- a/drivers/ide/tx4939ide.c +++ b/drivers/ide/tx4939ide.c | |||
@@ -327,15 +327,15 @@ static int tx4939ide_dma_end(ide_drive_t *drive) | |||
327 | /* read and clear the INTR & ERROR bits */ | 327 | /* read and clear the INTR & ERROR bits */ |
328 | dma_stat = tx4939ide_clear_dma_status(base); | 328 | dma_stat = tx4939ide_clear_dma_status(base); |
329 | 329 | ||
330 | wmb(); | 330 | #define CHECK_DMA_MASK (ATA_DMA_ACTIVE | ATA_DMA_ERR | ATA_DMA_INTR) |
331 | 331 | ||
332 | /* verify good DMA status */ | 332 | /* verify good DMA status */ |
333 | if ((dma_stat & (ATA_DMA_INTR | ATA_DMA_ERR | ATA_DMA_ACTIVE)) == 0 && | 333 | if ((dma_stat & CHECK_DMA_MASK) == 0 && |
334 | (ctl & (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST)) == | 334 | (ctl & (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST)) == |
335 | (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST)) | 335 | (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST)) |
336 | /* INT_IDE lost... bug? */ | 336 | /* INT_IDE lost... bug? */ |
337 | return 0; | 337 | return 0; |
338 | return ((dma_stat & (ATA_DMA_INTR | ATA_DMA_ERR | ATA_DMA_ACTIVE)) != | 338 | return ((dma_stat & CHECK_DMA_MASK) != |
339 | ATA_DMA_INTR) ? 0x10 | dma_stat : 0; | 339 | ATA_DMA_INTR) ? 0x10 | dma_stat : 0; |
340 | } | 340 | } |
341 | 341 | ||
@@ -434,97 +434,19 @@ static void tx4939ide_tf_load_fixup(ide_drive_t *drive) | |||
434 | tx4939ide_writew(sysctl, base, TX4939IDE_Sys_Ctl); | 434 | tx4939ide_writew(sysctl, base, TX4939IDE_Sys_Ctl); |
435 | } | 435 | } |
436 | 436 | ||
437 | #ifdef __BIG_ENDIAN | 437 | static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_taskfile *tf, |
438 | 438 | u8 valid) | |
439 | /* custom iops (independent from SWAP_IO_SPACE) */ | ||
440 | static u8 tx4939ide_inb(unsigned long port) | ||
441 | { | 439 | { |
442 | return __raw_readb((void __iomem *)port); | 440 | ide_tf_load(drive, tf, valid); |
443 | } | ||
444 | 441 | ||
445 | static void tx4939ide_outb(u8 value, unsigned long port) | 442 | if (valid & IDE_VALID_DEVICE) |
446 | { | ||
447 | __raw_writeb(value, (void __iomem *)port); | ||
448 | } | ||
449 | |||
450 | static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) | ||
451 | { | ||
452 | ide_hwif_t *hwif = drive->hwif; | ||
453 | struct ide_io_ports *io_ports = &hwif->io_ports; | ||
454 | struct ide_taskfile *tf = &cmd->tf; | ||
455 | u8 HIHI = cmd->tf_flags & IDE_TFLAG_LBA48 ? 0xE0 : 0xEF; | ||
456 | |||
457 | if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) | ||
458 | HIHI = 0xFF; | ||
459 | |||
460 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) | ||
461 | tx4939ide_outb(tf->hob_feature, io_ports->feature_addr); | ||
462 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) | ||
463 | tx4939ide_outb(tf->hob_nsect, io_ports->nsect_addr); | ||
464 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) | ||
465 | tx4939ide_outb(tf->hob_lbal, io_ports->lbal_addr); | ||
466 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) | ||
467 | tx4939ide_outb(tf->hob_lbam, io_ports->lbam_addr); | ||
468 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) | ||
469 | tx4939ide_outb(tf->hob_lbah, io_ports->lbah_addr); | ||
470 | |||
471 | if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) | ||
472 | tx4939ide_outb(tf->feature, io_ports->feature_addr); | ||
473 | if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) | ||
474 | tx4939ide_outb(tf->nsect, io_ports->nsect_addr); | ||
475 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) | ||
476 | tx4939ide_outb(tf->lbal, io_ports->lbal_addr); | ||
477 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) | ||
478 | tx4939ide_outb(tf->lbam, io_ports->lbam_addr); | ||
479 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) | ||
480 | tx4939ide_outb(tf->lbah, io_ports->lbah_addr); | ||
481 | |||
482 | if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) { | ||
483 | tx4939ide_outb((tf->device & HIHI) | drive->select, | ||
484 | io_ports->device_addr); | ||
485 | tx4939ide_tf_load_fixup(drive); | 443 | tx4939ide_tf_load_fixup(drive); |
486 | } | ||
487 | } | 444 | } |
488 | 445 | ||
489 | static void tx4939ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) | 446 | #ifdef __BIG_ENDIAN |
490 | { | ||
491 | ide_hwif_t *hwif = drive->hwif; | ||
492 | struct ide_io_ports *io_ports = &hwif->io_ports; | ||
493 | struct ide_taskfile *tf = &cmd->tf; | ||
494 | |||
495 | /* be sure we're looking at the low order bits */ | ||
496 | tx4939ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); | ||
497 | |||
498 | if (cmd->tf_flags & IDE_TFLAG_IN_ERROR) | ||
499 | tf->error = tx4939ide_inb(io_ports->feature_addr); | ||
500 | if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) | ||
501 | tf->nsect = tx4939ide_inb(io_ports->nsect_addr); | ||
502 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) | ||
503 | tf->lbal = tx4939ide_inb(io_ports->lbal_addr); | ||
504 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) | ||
505 | tf->lbam = tx4939ide_inb(io_ports->lbam_addr); | ||
506 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) | ||
507 | tf->lbah = tx4939ide_inb(io_ports->lbah_addr); | ||
508 | if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) | ||
509 | tf->device = tx4939ide_inb(io_ports->device_addr); | ||
510 | |||
511 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { | ||
512 | tx4939ide_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr); | ||
513 | |||
514 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_ERROR) | ||
515 | tf->hob_error = tx4939ide_inb(io_ports->feature_addr); | ||
516 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) | ||
517 | tf->hob_nsect = tx4939ide_inb(io_ports->nsect_addr); | ||
518 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) | ||
519 | tf->hob_lbal = tx4939ide_inb(io_ports->lbal_addr); | ||
520 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) | ||
521 | tf->hob_lbam = tx4939ide_inb(io_ports->lbam_addr); | ||
522 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) | ||
523 | tf->hob_lbah = tx4939ide_inb(io_ports->lbah_addr); | ||
524 | } | ||
525 | } | ||
526 | 447 | ||
527 | static void tx4939ide_input_data_swap(ide_drive_t *drive, struct request *rq, | 448 | /* custom iops (independent from SWAP_IO_SPACE) */ |
449 | static void tx4939ide_input_data_swap(ide_drive_t *drive, struct ide_cmd *cmd, | ||
528 | void *buf, unsigned int len) | 450 | void *buf, unsigned int len) |
529 | { | 451 | { |
530 | unsigned long port = drive->hwif->io_ports.data_addr; | 452 | unsigned long port = drive->hwif->io_ports.data_addr; |
@@ -536,7 +458,7 @@ static void tx4939ide_input_data_swap(ide_drive_t *drive, struct request *rq, | |||
536 | __ide_flush_dcache_range((unsigned long)buf, roundup(len, 2)); | 458 | __ide_flush_dcache_range((unsigned long)buf, roundup(len, 2)); |
537 | } | 459 | } |
538 | 460 | ||
539 | static void tx4939ide_output_data_swap(ide_drive_t *drive, struct request *rq, | 461 | static void tx4939ide_output_data_swap(ide_drive_t *drive, struct ide_cmd *cmd, |
540 | void *buf, unsigned int len) | 462 | void *buf, unsigned int len) |
541 | { | 463 | { |
542 | unsigned long port = drive->hwif->io_ports.data_addr; | 464 | unsigned long port = drive->hwif->io_ports.data_addr; |
@@ -558,7 +480,7 @@ static const struct ide_tp_ops tx4939ide_tp_ops = { | |||
558 | 480 | ||
559 | .dev_select = ide_dev_select, | 481 | .dev_select = ide_dev_select, |
560 | .tf_load = tx4939ide_tf_load, | 482 | .tf_load = tx4939ide_tf_load, |
561 | .tf_read = tx4939ide_tf_read, | 483 | .tf_read = ide_tf_read, |
562 | 484 | ||
563 | .input_data = tx4939ide_input_data_swap, | 485 | .input_data = tx4939ide_input_data_swap, |
564 | .output_data = tx4939ide_output_data_swap, | 486 | .output_data = tx4939ide_output_data_swap, |
@@ -566,14 +488,6 @@ static const struct ide_tp_ops tx4939ide_tp_ops = { | |||
566 | 488 | ||
567 | #else /* __LITTLE_ENDIAN */ | 489 | #else /* __LITTLE_ENDIAN */ |
568 | 490 | ||
569 | static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) | ||
570 | { | ||
571 | ide_tf_load(drive, cmd); | ||
572 | |||
573 | if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) | ||
574 | tx4939ide_tf_load_fixup(drive); | ||
575 | } | ||
576 | |||
577 | static const struct ide_tp_ops tx4939ide_tp_ops = { | 491 | static const struct ide_tp_ops tx4939ide_tp_ops = { |
578 | .exec_command = ide_exec_command, | 492 | .exec_command = ide_exec_command, |
579 | .read_status = ide_read_status, | 493 | .read_status = ide_read_status, |
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 2a2e50871b40..851de83ff455 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -297,21 +297,25 @@ static void cma_detach_from_dev(struct rdma_id_private *id_priv) | |||
297 | id_priv->cma_dev = NULL; | 297 | id_priv->cma_dev = NULL; |
298 | } | 298 | } |
299 | 299 | ||
300 | static int cma_set_qkey(struct ib_device *device, u8 port_num, | 300 | static int cma_set_qkey(struct rdma_id_private *id_priv) |
301 | enum rdma_port_space ps, | ||
302 | struct rdma_dev_addr *dev_addr, u32 *qkey) | ||
303 | { | 301 | { |
304 | struct ib_sa_mcmember_rec rec; | 302 | struct ib_sa_mcmember_rec rec; |
305 | int ret = 0; | 303 | int ret = 0; |
306 | 304 | ||
307 | switch (ps) { | 305 | if (id_priv->qkey) |
306 | return 0; | ||
307 | |||
308 | switch (id_priv->id.ps) { | ||
308 | case RDMA_PS_UDP: | 309 | case RDMA_PS_UDP: |
309 | *qkey = RDMA_UDP_QKEY; | 310 | id_priv->qkey = RDMA_UDP_QKEY; |
310 | break; | 311 | break; |
311 | case RDMA_PS_IPOIB: | 312 | case RDMA_PS_IPOIB: |
312 | ib_addr_get_mgid(dev_addr, &rec.mgid); | 313 | ib_addr_get_mgid(&id_priv->id.route.addr.dev_addr, &rec.mgid); |
313 | ret = ib_sa_get_mcmember_rec(device, port_num, &rec.mgid, &rec); | 314 | ret = ib_sa_get_mcmember_rec(id_priv->id.device, |
314 | *qkey = be32_to_cpu(rec.qkey); | 315 | id_priv->id.port_num, &rec.mgid, |
316 | &rec); | ||
317 | if (!ret) | ||
318 | id_priv->qkey = be32_to_cpu(rec.qkey); | ||
315 | break; | 319 | break; |
316 | default: | 320 | default: |
317 | break; | 321 | break; |
@@ -341,12 +345,7 @@ static int cma_acquire_dev(struct rdma_id_private *id_priv) | |||
341 | ret = ib_find_cached_gid(cma_dev->device, &gid, | 345 | ret = ib_find_cached_gid(cma_dev->device, &gid, |
342 | &id_priv->id.port_num, NULL); | 346 | &id_priv->id.port_num, NULL); |
343 | if (!ret) { | 347 | if (!ret) { |
344 | ret = cma_set_qkey(cma_dev->device, | 348 | cma_attach_to_dev(id_priv, cma_dev); |
345 | id_priv->id.port_num, | ||
346 | id_priv->id.ps, dev_addr, | ||
347 | &id_priv->qkey); | ||
348 | if (!ret) | ||
349 | cma_attach_to_dev(id_priv, cma_dev); | ||
350 | break; | 349 | break; |
351 | } | 350 | } |
352 | } | 351 | } |
@@ -578,6 +577,10 @@ static int cma_ib_init_qp_attr(struct rdma_id_private *id_priv, | |||
578 | *qp_attr_mask = IB_QP_STATE | IB_QP_PKEY_INDEX | IB_QP_PORT; | 577 | *qp_attr_mask = IB_QP_STATE | IB_QP_PKEY_INDEX | IB_QP_PORT; |
579 | 578 | ||
580 | if (cma_is_ud_ps(id_priv->id.ps)) { | 579 | if (cma_is_ud_ps(id_priv->id.ps)) { |
580 | ret = cma_set_qkey(id_priv); | ||
581 | if (ret) | ||
582 | return ret; | ||
583 | |||
581 | qp_attr->qkey = id_priv->qkey; | 584 | qp_attr->qkey = id_priv->qkey; |
582 | *qp_attr_mask |= IB_QP_QKEY; | 585 | *qp_attr_mask |= IB_QP_QKEY; |
583 | } else { | 586 | } else { |
@@ -2201,6 +2204,12 @@ static int cma_sidr_rep_handler(struct ib_cm_id *cm_id, | |||
2201 | event.status = ib_event->param.sidr_rep_rcvd.status; | 2204 | event.status = ib_event->param.sidr_rep_rcvd.status; |
2202 | break; | 2205 | break; |
2203 | } | 2206 | } |
2207 | ret = cma_set_qkey(id_priv); | ||
2208 | if (ret) { | ||
2209 | event.event = RDMA_CM_EVENT_ADDR_ERROR; | ||
2210 | event.status = -EINVAL; | ||
2211 | break; | ||
2212 | } | ||
2204 | if (id_priv->qkey != rep->qkey) { | 2213 | if (id_priv->qkey != rep->qkey) { |
2205 | event.event = RDMA_CM_EVENT_UNREACHABLE; | 2214 | event.event = RDMA_CM_EVENT_UNREACHABLE; |
2206 | event.status = -EINVAL; | 2215 | event.status = -EINVAL; |
@@ -2480,10 +2489,14 @@ static int cma_send_sidr_rep(struct rdma_id_private *id_priv, | |||
2480 | const void *private_data, int private_data_len) | 2489 | const void *private_data, int private_data_len) |
2481 | { | 2490 | { |
2482 | struct ib_cm_sidr_rep_param rep; | 2491 | struct ib_cm_sidr_rep_param rep; |
2492 | int ret; | ||
2483 | 2493 | ||
2484 | memset(&rep, 0, sizeof rep); | 2494 | memset(&rep, 0, sizeof rep); |
2485 | rep.status = status; | 2495 | rep.status = status; |
2486 | if (status == IB_SIDR_SUCCESS) { | 2496 | if (status == IB_SIDR_SUCCESS) { |
2497 | ret = cma_set_qkey(id_priv); | ||
2498 | if (ret) | ||
2499 | return ret; | ||
2487 | rep.qp_num = id_priv->qp_num; | 2500 | rep.qp_num = id_priv->qp_num; |
2488 | rep.qkey = id_priv->qkey; | 2501 | rep.qkey = id_priv->qkey; |
2489 | } | 2502 | } |
@@ -2713,6 +2726,10 @@ static int cma_join_ib_multicast(struct rdma_id_private *id_priv, | |||
2713 | IB_SA_MCMEMBER_REC_FLOW_LABEL | | 2726 | IB_SA_MCMEMBER_REC_FLOW_LABEL | |
2714 | IB_SA_MCMEMBER_REC_TRAFFIC_CLASS; | 2727 | IB_SA_MCMEMBER_REC_TRAFFIC_CLASS; |
2715 | 2728 | ||
2729 | if (id_priv->id.ps == RDMA_PS_IPOIB) | ||
2730 | comp_mask |= IB_SA_MCMEMBER_REC_RATE | | ||
2731 | IB_SA_MCMEMBER_REC_RATE_SELECTOR; | ||
2732 | |||
2716 | mc->multicast.ib = ib_sa_join_multicast(&sa_client, id_priv->id.device, | 2733 | mc->multicast.ib = ib_sa_join_multicast(&sa_client, id_priv->id.device, |
2717 | id_priv->id.port_num, &rec, | 2734 | id_priv->id.port_num, &rec, |
2718 | comp_mask, GFP_KERNEL, | 2735 | comp_mask, GFP_KERNEL, |
diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c index a4a82bff7100..8d71086f5a1c 100644 --- a/drivers/infiniband/hw/cxgb3/cxio_hal.c +++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c | |||
@@ -152,7 +152,7 @@ static int cxio_hal_clear_qp_ctx(struct cxio_rdev *rdev_p, u32 qpid) | |||
152 | sge_cmd = qpid << 8 | 3; | 152 | sge_cmd = qpid << 8 | 3; |
153 | wqe->sge_cmd = cpu_to_be64(sge_cmd); | 153 | wqe->sge_cmd = cpu_to_be64(sge_cmd); |
154 | skb->priority = CPL_PRIORITY_CONTROL; | 154 | skb->priority = CPL_PRIORITY_CONTROL; |
155 | return (cxgb3_ofld_send(rdev_p->t3cdev_p, skb)); | 155 | return iwch_cxgb3_ofld_send(rdev_p->t3cdev_p, skb); |
156 | } | 156 | } |
157 | 157 | ||
158 | int cxio_create_cq(struct cxio_rdev *rdev_p, struct t3_cq *cq) | 158 | int cxio_create_cq(struct cxio_rdev *rdev_p, struct t3_cq *cq) |
@@ -571,7 +571,7 @@ static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p) | |||
571 | (unsigned long long) rdev_p->ctrl_qp.dma_addr, | 571 | (unsigned long long) rdev_p->ctrl_qp.dma_addr, |
572 | rdev_p->ctrl_qp.workq, 1 << T3_CTRL_QP_SIZE_LOG2); | 572 | rdev_p->ctrl_qp.workq, 1 << T3_CTRL_QP_SIZE_LOG2); |
573 | skb->priority = CPL_PRIORITY_CONTROL; | 573 | skb->priority = CPL_PRIORITY_CONTROL; |
574 | return (cxgb3_ofld_send(rdev_p->t3cdev_p, skb)); | 574 | return iwch_cxgb3_ofld_send(rdev_p->t3cdev_p, skb); |
575 | err: | 575 | err: |
576 | kfree_skb(skb); | 576 | kfree_skb(skb); |
577 | return err; | 577 | return err; |
@@ -701,7 +701,7 @@ static int __cxio_tpt_op(struct cxio_rdev *rdev_p, u32 reset_tpt_entry, | |||
701 | u32 stag_idx; | 701 | u32 stag_idx; |
702 | u32 wptr; | 702 | u32 wptr; |
703 | 703 | ||
704 | if (rdev_p->flags) | 704 | if (cxio_fatal_error(rdev_p)) |
705 | return -EIO; | 705 | return -EIO; |
706 | 706 | ||
707 | stag_state = stag_state > 0; | 707 | stag_state = stag_state > 0; |
@@ -858,7 +858,7 @@ int cxio_rdma_init(struct cxio_rdev *rdev_p, struct t3_rdma_init_attr *attr) | |||
858 | wqe->qp_dma_size = cpu_to_be32(attr->qp_dma_size); | 858 | wqe->qp_dma_size = cpu_to_be32(attr->qp_dma_size); |
859 | wqe->irs = cpu_to_be32(attr->irs); | 859 | wqe->irs = cpu_to_be32(attr->irs); |
860 | skb->priority = 0; /* 0=>ToeQ; 1=>CtrlQ */ | 860 | skb->priority = 0; /* 0=>ToeQ; 1=>CtrlQ */ |
861 | return (cxgb3_ofld_send(rdev_p->t3cdev_p, skb)); | 861 | return iwch_cxgb3_ofld_send(rdev_p->t3cdev_p, skb); |
862 | } | 862 | } |
863 | 863 | ||
864 | void cxio_register_ev_cb(cxio_hal_ev_callback_func_t ev_cb) | 864 | void cxio_register_ev_cb(cxio_hal_ev_callback_func_t ev_cb) |
@@ -1041,9 +1041,9 @@ void cxio_rdev_close(struct cxio_rdev *rdev_p) | |||
1041 | cxio_hal_pblpool_destroy(rdev_p); | 1041 | cxio_hal_pblpool_destroy(rdev_p); |
1042 | cxio_hal_rqtpool_destroy(rdev_p); | 1042 | cxio_hal_rqtpool_destroy(rdev_p); |
1043 | list_del(&rdev_p->entry); | 1043 | list_del(&rdev_p->entry); |
1044 | rdev_p->t3cdev_p->ulp = NULL; | ||
1045 | cxio_hal_destroy_ctrl_qp(rdev_p); | 1044 | cxio_hal_destroy_ctrl_qp(rdev_p); |
1046 | cxio_hal_destroy_resource(rdev_p->rscp); | 1045 | cxio_hal_destroy_resource(rdev_p->rscp); |
1046 | rdev_p->t3cdev_p->ulp = NULL; | ||
1047 | } | 1047 | } |
1048 | } | 1048 | } |
1049 | 1049 | ||
diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.h b/drivers/infiniband/hw/cxgb3/cxio_hal.h index 094a66d1480c..bfd03bf8be54 100644 --- a/drivers/infiniband/hw/cxgb3/cxio_hal.h +++ b/drivers/infiniband/hw/cxgb3/cxio_hal.h | |||
@@ -115,6 +115,11 @@ struct cxio_rdev { | |||
115 | #define CXIO_ERROR_FATAL 1 | 115 | #define CXIO_ERROR_FATAL 1 |
116 | }; | 116 | }; |
117 | 117 | ||
118 | static inline int cxio_fatal_error(struct cxio_rdev *rdev_p) | ||
119 | { | ||
120 | return rdev_p->flags & CXIO_ERROR_FATAL; | ||
121 | } | ||
122 | |||
118 | static inline int cxio_num_stags(struct cxio_rdev *rdev_p) | 123 | static inline int cxio_num_stags(struct cxio_rdev *rdev_p) |
119 | { | 124 | { |
120 | return min((int)T3_MAX_NUM_STAG, (int)((rdev_p->rnic_info.tpt_top - rdev_p->rnic_info.tpt_base) >> 5)); | 125 | return min((int)T3_MAX_NUM_STAG, (int)((rdev_p->rnic_info.tpt_top - rdev_p->rnic_info.tpt_base) >> 5)); |
@@ -188,6 +193,7 @@ void cxio_count_scqes(struct t3_cq *cq, struct t3_wq *wq, int *count); | |||
188 | void cxio_flush_hw_cq(struct t3_cq *cq); | 193 | void cxio_flush_hw_cq(struct t3_cq *cq); |
189 | int cxio_poll_cq(struct t3_wq *wq, struct t3_cq *cq, struct t3_cqe *cqe, | 194 | int cxio_poll_cq(struct t3_wq *wq, struct t3_cq *cq, struct t3_cqe *cqe, |
190 | u8 *cqe_flushed, u64 *cookie, u32 *credit); | 195 | u8 *cqe_flushed, u64 *cookie, u32 *credit); |
196 | int iwch_cxgb3_ofld_send(struct t3cdev *tdev, struct sk_buff *skb); | ||
191 | 197 | ||
192 | #define MOD "iw_cxgb3: " | 198 | #define MOD "iw_cxgb3: " |
193 | #define PDBG(fmt, args...) pr_debug(MOD fmt, ## args) | 199 | #define PDBG(fmt, args...) pr_debug(MOD fmt, ## args) |
diff --git a/drivers/infiniband/hw/cxgb3/iwch.c b/drivers/infiniband/hw/cxgb3/iwch.c index 37a4fc264a07..26fc0a4eaa74 100644 --- a/drivers/infiniband/hw/cxgb3/iwch.c +++ b/drivers/infiniband/hw/cxgb3/iwch.c | |||
@@ -165,12 +165,19 @@ static void close_rnic_dev(struct t3cdev *tdev) | |||
165 | static void iwch_err_handler(struct t3cdev *tdev, u32 status, u32 error) | 165 | static void iwch_err_handler(struct t3cdev *tdev, u32 status, u32 error) |
166 | { | 166 | { |
167 | struct cxio_rdev *rdev = tdev->ulp; | 167 | struct cxio_rdev *rdev = tdev->ulp; |
168 | struct iwch_dev *rnicp = rdev_to_iwch_dev(rdev); | ||
169 | struct ib_event event; | ||
168 | 170 | ||
169 | if (status == OFFLOAD_STATUS_DOWN) | 171 | if (status == OFFLOAD_STATUS_DOWN) { |
170 | rdev->flags = CXIO_ERROR_FATAL; | 172 | rdev->flags = CXIO_ERROR_FATAL; |
171 | 173 | ||
172 | return; | 174 | event.device = &rnicp->ibdev; |
175 | event.event = IB_EVENT_DEVICE_FATAL; | ||
176 | event.element.port_num = 0; | ||
177 | ib_dispatch_event(&event); | ||
178 | } | ||
173 | 179 | ||
180 | return; | ||
174 | } | 181 | } |
175 | 182 | ||
176 | static int __init iwch_init_module(void) | 183 | static int __init iwch_init_module(void) |
diff --git a/drivers/infiniband/hw/cxgb3/iwch.h b/drivers/infiniband/hw/cxgb3/iwch.h index 3773453b2cf0..84735506333f 100644 --- a/drivers/infiniband/hw/cxgb3/iwch.h +++ b/drivers/infiniband/hw/cxgb3/iwch.h | |||
@@ -117,6 +117,11 @@ static inline struct iwch_dev *to_iwch_dev(struct ib_device *ibdev) | |||
117 | return container_of(ibdev, struct iwch_dev, ibdev); | 117 | return container_of(ibdev, struct iwch_dev, ibdev); |
118 | } | 118 | } |
119 | 119 | ||
120 | static inline struct iwch_dev *rdev_to_iwch_dev(struct cxio_rdev *rdev) | ||
121 | { | ||
122 | return container_of(rdev, struct iwch_dev, rdev); | ||
123 | } | ||
124 | |||
120 | static inline int t3b_device(const struct iwch_dev *rhp) | 125 | static inline int t3b_device(const struct iwch_dev *rhp) |
121 | { | 126 | { |
122 | return rhp->rdev.t3cdev_p->type == T3B; | 127 | return rhp->rdev.t3cdev_p->type == T3B; |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c index 8699947aaf6c..fef3f1ae7225 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_cm.c +++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c | |||
@@ -139,6 +139,38 @@ static void stop_ep_timer(struct iwch_ep *ep) | |||
139 | put_ep(&ep->com); | 139 | put_ep(&ep->com); |
140 | } | 140 | } |
141 | 141 | ||
142 | int iwch_l2t_send(struct t3cdev *tdev, struct sk_buff *skb, struct l2t_entry *l2e) | ||
143 | { | ||
144 | int error = 0; | ||
145 | struct cxio_rdev *rdev; | ||
146 | |||
147 | rdev = (struct cxio_rdev *)tdev->ulp; | ||
148 | if (cxio_fatal_error(rdev)) { | ||
149 | kfree_skb(skb); | ||
150 | return -EIO; | ||
151 | } | ||
152 | error = l2t_send(tdev, skb, l2e); | ||
153 | if (error) | ||
154 | kfree_skb(skb); | ||
155 | return error; | ||
156 | } | ||
157 | |||
158 | int iwch_cxgb3_ofld_send(struct t3cdev *tdev, struct sk_buff *skb) | ||
159 | { | ||
160 | int error = 0; | ||
161 | struct cxio_rdev *rdev; | ||
162 | |||
163 | rdev = (struct cxio_rdev *)tdev->ulp; | ||
164 | if (cxio_fatal_error(rdev)) { | ||
165 | kfree_skb(skb); | ||
166 | return -EIO; | ||
167 | } | ||
168 | error = cxgb3_ofld_send(tdev, skb); | ||
169 | if (error) | ||
170 | kfree_skb(skb); | ||
171 | return error; | ||
172 | } | ||
173 | |||
142 | static void release_tid(struct t3cdev *tdev, u32 hwtid, struct sk_buff *skb) | 174 | static void release_tid(struct t3cdev *tdev, u32 hwtid, struct sk_buff *skb) |
143 | { | 175 | { |
144 | struct cpl_tid_release *req; | 176 | struct cpl_tid_release *req; |
@@ -150,7 +182,7 @@ static void release_tid(struct t3cdev *tdev, u32 hwtid, struct sk_buff *skb) | |||
150 | req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); | 182 | req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); |
151 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_TID_RELEASE, hwtid)); | 183 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_TID_RELEASE, hwtid)); |
152 | skb->priority = CPL_PRIORITY_SETUP; | 184 | skb->priority = CPL_PRIORITY_SETUP; |
153 | cxgb3_ofld_send(tdev, skb); | 185 | iwch_cxgb3_ofld_send(tdev, skb); |
154 | return; | 186 | return; |
155 | } | 187 | } |
156 | 188 | ||
@@ -172,8 +204,7 @@ int iwch_quiesce_tid(struct iwch_ep *ep) | |||
172 | req->val = cpu_to_be64(1 << S_TCB_RX_QUIESCE); | 204 | req->val = cpu_to_be64(1 << S_TCB_RX_QUIESCE); |
173 | 205 | ||
174 | skb->priority = CPL_PRIORITY_DATA; | 206 | skb->priority = CPL_PRIORITY_DATA; |
175 | cxgb3_ofld_send(ep->com.tdev, skb); | 207 | return iwch_cxgb3_ofld_send(ep->com.tdev, skb); |
176 | return 0; | ||
177 | } | 208 | } |
178 | 209 | ||
179 | int iwch_resume_tid(struct iwch_ep *ep) | 210 | int iwch_resume_tid(struct iwch_ep *ep) |
@@ -194,8 +225,7 @@ int iwch_resume_tid(struct iwch_ep *ep) | |||
194 | req->val = 0; | 225 | req->val = 0; |
195 | 226 | ||
196 | skb->priority = CPL_PRIORITY_DATA; | 227 | skb->priority = CPL_PRIORITY_DATA; |
197 | cxgb3_ofld_send(ep->com.tdev, skb); | 228 | return iwch_cxgb3_ofld_send(ep->com.tdev, skb); |
198 | return 0; | ||
199 | } | 229 | } |
200 | 230 | ||
201 | static void set_emss(struct iwch_ep *ep, u16 opt) | 231 | static void set_emss(struct iwch_ep *ep, u16 opt) |
@@ -252,18 +282,22 @@ static void *alloc_ep(int size, gfp_t gfp) | |||
252 | 282 | ||
253 | void __free_ep(struct kref *kref) | 283 | void __free_ep(struct kref *kref) |
254 | { | 284 | { |
255 | struct iwch_ep_common *epc; | 285 | struct iwch_ep *ep; |
256 | epc = container_of(kref, struct iwch_ep_common, kref); | 286 | ep = container_of(container_of(kref, struct iwch_ep_common, kref), |
257 | PDBG("%s ep %p state %s\n", __func__, epc, states[state_read(epc)]); | 287 | struct iwch_ep, com); |
258 | kfree(epc); | 288 | PDBG("%s ep %p state %s\n", __func__, ep, states[state_read(&ep->com)]); |
289 | if (ep->com.flags & RELEASE_RESOURCES) { | ||
290 | cxgb3_remove_tid(ep->com.tdev, (void *)ep, ep->hwtid); | ||
291 | dst_release(ep->dst); | ||
292 | l2t_release(L2DATA(ep->com.tdev), ep->l2t); | ||
293 | } | ||
294 | kfree(ep); | ||
259 | } | 295 | } |
260 | 296 | ||
261 | static void release_ep_resources(struct iwch_ep *ep) | 297 | static void release_ep_resources(struct iwch_ep *ep) |
262 | { | 298 | { |
263 | PDBG("%s ep %p tid %d\n", __func__, ep, ep->hwtid); | 299 | PDBG("%s ep %p tid %d\n", __func__, ep, ep->hwtid); |
264 | cxgb3_remove_tid(ep->com.tdev, (void *)ep, ep->hwtid); | 300 | ep->com.flags |= RELEASE_RESOURCES; |
265 | dst_release(ep->dst); | ||
266 | l2t_release(L2DATA(ep->com.tdev), ep->l2t); | ||
267 | put_ep(&ep->com); | 301 | put_ep(&ep->com); |
268 | } | 302 | } |
269 | 303 | ||
@@ -382,7 +416,7 @@ static void abort_arp_failure(struct t3cdev *dev, struct sk_buff *skb) | |||
382 | 416 | ||
383 | PDBG("%s t3cdev %p\n", __func__, dev); | 417 | PDBG("%s t3cdev %p\n", __func__, dev); |
384 | req->cmd = CPL_ABORT_NO_RST; | 418 | req->cmd = CPL_ABORT_NO_RST; |
385 | cxgb3_ofld_send(dev, skb); | 419 | iwch_cxgb3_ofld_send(dev, skb); |
386 | } | 420 | } |
387 | 421 | ||
388 | static int send_halfclose(struct iwch_ep *ep, gfp_t gfp) | 422 | static int send_halfclose(struct iwch_ep *ep, gfp_t gfp) |
@@ -402,8 +436,7 @@ static int send_halfclose(struct iwch_ep *ep, gfp_t gfp) | |||
402 | req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_OFLD_CLOSE_CON)); | 436 | req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_OFLD_CLOSE_CON)); |
403 | req->wr.wr_lo = htonl(V_WR_TID(ep->hwtid)); | 437 | req->wr.wr_lo = htonl(V_WR_TID(ep->hwtid)); |
404 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_CLOSE_CON_REQ, ep->hwtid)); | 438 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_CLOSE_CON_REQ, ep->hwtid)); |
405 | l2t_send(ep->com.tdev, skb, ep->l2t); | 439 | return iwch_l2t_send(ep->com.tdev, skb, ep->l2t); |
406 | return 0; | ||
407 | } | 440 | } |
408 | 441 | ||
409 | static int send_abort(struct iwch_ep *ep, struct sk_buff *skb, gfp_t gfp) | 442 | static int send_abort(struct iwch_ep *ep, struct sk_buff *skb, gfp_t gfp) |
@@ -424,8 +457,7 @@ static int send_abort(struct iwch_ep *ep, struct sk_buff *skb, gfp_t gfp) | |||
424 | req->wr.wr_lo = htonl(V_WR_TID(ep->hwtid)); | 457 | req->wr.wr_lo = htonl(V_WR_TID(ep->hwtid)); |
425 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_ABORT_REQ, ep->hwtid)); | 458 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_ABORT_REQ, ep->hwtid)); |
426 | req->cmd = CPL_ABORT_SEND_RST; | 459 | req->cmd = CPL_ABORT_SEND_RST; |
427 | l2t_send(ep->com.tdev, skb, ep->l2t); | 460 | return iwch_l2t_send(ep->com.tdev, skb, ep->l2t); |
428 | return 0; | ||
429 | } | 461 | } |
430 | 462 | ||
431 | static int send_connect(struct iwch_ep *ep) | 463 | static int send_connect(struct iwch_ep *ep) |
@@ -469,8 +501,7 @@ static int send_connect(struct iwch_ep *ep) | |||
469 | req->opt0l = htonl(opt0l); | 501 | req->opt0l = htonl(opt0l); |
470 | req->params = 0; | 502 | req->params = 0; |
471 | req->opt2 = htonl(opt2); | 503 | req->opt2 = htonl(opt2); |
472 | l2t_send(ep->com.tdev, skb, ep->l2t); | 504 | return iwch_l2t_send(ep->com.tdev, skb, ep->l2t); |
473 | return 0; | ||
474 | } | 505 | } |
475 | 506 | ||
476 | static void send_mpa_req(struct iwch_ep *ep, struct sk_buff *skb) | 507 | static void send_mpa_req(struct iwch_ep *ep, struct sk_buff *skb) |
@@ -527,7 +558,7 @@ static void send_mpa_req(struct iwch_ep *ep, struct sk_buff *skb) | |||
527 | req->sndseq = htonl(ep->snd_seq); | 558 | req->sndseq = htonl(ep->snd_seq); |
528 | BUG_ON(ep->mpa_skb); | 559 | BUG_ON(ep->mpa_skb); |
529 | ep->mpa_skb = skb; | 560 | ep->mpa_skb = skb; |
530 | l2t_send(ep->com.tdev, skb, ep->l2t); | 561 | iwch_l2t_send(ep->com.tdev, skb, ep->l2t); |
531 | start_ep_timer(ep); | 562 | start_ep_timer(ep); |
532 | state_set(&ep->com, MPA_REQ_SENT); | 563 | state_set(&ep->com, MPA_REQ_SENT); |
533 | return; | 564 | return; |
@@ -578,8 +609,7 @@ static int send_mpa_reject(struct iwch_ep *ep, const void *pdata, u8 plen) | |||
578 | req->sndseq = htonl(ep->snd_seq); | 609 | req->sndseq = htonl(ep->snd_seq); |
579 | BUG_ON(ep->mpa_skb); | 610 | BUG_ON(ep->mpa_skb); |
580 | ep->mpa_skb = skb; | 611 | ep->mpa_skb = skb; |
581 | l2t_send(ep->com.tdev, skb, ep->l2t); | 612 | return iwch_l2t_send(ep->com.tdev, skb, ep->l2t); |
582 | return 0; | ||
583 | } | 613 | } |
584 | 614 | ||
585 | static int send_mpa_reply(struct iwch_ep *ep, const void *pdata, u8 plen) | 615 | static int send_mpa_reply(struct iwch_ep *ep, const void *pdata, u8 plen) |
@@ -630,8 +660,7 @@ static int send_mpa_reply(struct iwch_ep *ep, const void *pdata, u8 plen) | |||
630 | req->sndseq = htonl(ep->snd_seq); | 660 | req->sndseq = htonl(ep->snd_seq); |
631 | ep->mpa_skb = skb; | 661 | ep->mpa_skb = skb; |
632 | state_set(&ep->com, MPA_REP_SENT); | 662 | state_set(&ep->com, MPA_REP_SENT); |
633 | l2t_send(ep->com.tdev, skb, ep->l2t); | 663 | return iwch_l2t_send(ep->com.tdev, skb, ep->l2t); |
634 | return 0; | ||
635 | } | 664 | } |
636 | 665 | ||
637 | static int act_establish(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | 666 | static int act_establish(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) |
@@ -795,7 +824,7 @@ static int update_rx_credits(struct iwch_ep *ep, u32 credits) | |||
795 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_RX_DATA_ACK, ep->hwtid)); | 824 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_RX_DATA_ACK, ep->hwtid)); |
796 | req->credit_dack = htonl(V_RX_CREDITS(credits) | V_RX_FORCE_ACK(1)); | 825 | req->credit_dack = htonl(V_RX_CREDITS(credits) | V_RX_FORCE_ACK(1)); |
797 | skb->priority = CPL_PRIORITY_ACK; | 826 | skb->priority = CPL_PRIORITY_ACK; |
798 | cxgb3_ofld_send(ep->com.tdev, skb); | 827 | iwch_cxgb3_ofld_send(ep->com.tdev, skb); |
799 | return credits; | 828 | return credits; |
800 | } | 829 | } |
801 | 830 | ||
@@ -1127,8 +1156,8 @@ static int abort_rpl(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | |||
1127 | * We get 2 abort replies from the HW. The first one must | 1156 | * We get 2 abort replies from the HW. The first one must |
1128 | * be ignored except for scribbling that we need one more. | 1157 | * be ignored except for scribbling that we need one more. |
1129 | */ | 1158 | */ |
1130 | if (!(ep->flags & ABORT_REQ_IN_PROGRESS)) { | 1159 | if (!(ep->com.flags & ABORT_REQ_IN_PROGRESS)) { |
1131 | ep->flags |= ABORT_REQ_IN_PROGRESS; | 1160 | ep->com.flags |= ABORT_REQ_IN_PROGRESS; |
1132 | return CPL_RET_BUF_DONE; | 1161 | return CPL_RET_BUF_DONE; |
1133 | } | 1162 | } |
1134 | 1163 | ||
@@ -1203,8 +1232,7 @@ static int listen_start(struct iwch_listen_ep *ep) | |||
1203 | req->opt1 = htonl(V_CONN_POLICY(CPL_CONN_POLICY_ASK)); | 1232 | req->opt1 = htonl(V_CONN_POLICY(CPL_CONN_POLICY_ASK)); |
1204 | 1233 | ||
1205 | skb->priority = 1; | 1234 | skb->priority = 1; |
1206 | cxgb3_ofld_send(ep->com.tdev, skb); | 1235 | return iwch_cxgb3_ofld_send(ep->com.tdev, skb); |
1207 | return 0; | ||
1208 | } | 1236 | } |
1209 | 1237 | ||
1210 | static int pass_open_rpl(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | 1238 | static int pass_open_rpl(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) |
@@ -1237,8 +1265,7 @@ static int listen_stop(struct iwch_listen_ep *ep) | |||
1237 | req->cpu_idx = 0; | 1265 | req->cpu_idx = 0; |
1238 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_CLOSE_LISTSRV_REQ, ep->stid)); | 1266 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_CLOSE_LISTSRV_REQ, ep->stid)); |
1239 | skb->priority = 1; | 1267 | skb->priority = 1; |
1240 | cxgb3_ofld_send(ep->com.tdev, skb); | 1268 | return iwch_cxgb3_ofld_send(ep->com.tdev, skb); |
1241 | return 0; | ||
1242 | } | 1269 | } |
1243 | 1270 | ||
1244 | static int close_listsrv_rpl(struct t3cdev *tdev, struct sk_buff *skb, | 1271 | static int close_listsrv_rpl(struct t3cdev *tdev, struct sk_buff *skb, |
@@ -1286,7 +1313,7 @@ static void accept_cr(struct iwch_ep *ep, __be32 peer_ip, struct sk_buff *skb) | |||
1286 | rpl->opt2 = htonl(opt2); | 1313 | rpl->opt2 = htonl(opt2); |
1287 | rpl->rsvd = rpl->opt2; /* workaround for HW bug */ | 1314 | rpl->rsvd = rpl->opt2; /* workaround for HW bug */ |
1288 | skb->priority = CPL_PRIORITY_SETUP; | 1315 | skb->priority = CPL_PRIORITY_SETUP; |
1289 | l2t_send(ep->com.tdev, skb, ep->l2t); | 1316 | iwch_l2t_send(ep->com.tdev, skb, ep->l2t); |
1290 | 1317 | ||
1291 | return; | 1318 | return; |
1292 | } | 1319 | } |
@@ -1315,7 +1342,7 @@ static void reject_cr(struct t3cdev *tdev, u32 hwtid, __be32 peer_ip, | |||
1315 | rpl->opt0l_status = htonl(CPL_PASS_OPEN_REJECT); | 1342 | rpl->opt0l_status = htonl(CPL_PASS_OPEN_REJECT); |
1316 | rpl->opt2 = 0; | 1343 | rpl->opt2 = 0; |
1317 | rpl->rsvd = rpl->opt2; | 1344 | rpl->rsvd = rpl->opt2; |
1318 | cxgb3_ofld_send(tdev, skb); | 1345 | iwch_cxgb3_ofld_send(tdev, skb); |
1319 | } | 1346 | } |
1320 | } | 1347 | } |
1321 | 1348 | ||
@@ -1534,8 +1561,8 @@ static int peer_abort(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | |||
1534 | * We get 2 peer aborts from the HW. The first one must | 1561 | * We get 2 peer aborts from the HW. The first one must |
1535 | * be ignored except for scribbling that we need one more. | 1562 | * be ignored except for scribbling that we need one more. |
1536 | */ | 1563 | */ |
1537 | if (!(ep->flags & PEER_ABORT_IN_PROGRESS)) { | 1564 | if (!(ep->com.flags & PEER_ABORT_IN_PROGRESS)) { |
1538 | ep->flags |= PEER_ABORT_IN_PROGRESS; | 1565 | ep->com.flags |= PEER_ABORT_IN_PROGRESS; |
1539 | return CPL_RET_BUF_DONE; | 1566 | return CPL_RET_BUF_DONE; |
1540 | } | 1567 | } |
1541 | 1568 | ||
@@ -1613,7 +1640,7 @@ static int peer_abort(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | |||
1613 | rpl->wr.wr_lo = htonl(V_WR_TID(ep->hwtid)); | 1640 | rpl->wr.wr_lo = htonl(V_WR_TID(ep->hwtid)); |
1614 | OPCODE_TID(rpl) = htonl(MK_OPCODE_TID(CPL_ABORT_RPL, ep->hwtid)); | 1641 | OPCODE_TID(rpl) = htonl(MK_OPCODE_TID(CPL_ABORT_RPL, ep->hwtid)); |
1615 | rpl->cmd = CPL_ABORT_NO_RST; | 1642 | rpl->cmd = CPL_ABORT_NO_RST; |
1616 | cxgb3_ofld_send(ep->com.tdev, rpl_skb); | 1643 | iwch_cxgb3_ofld_send(ep->com.tdev, rpl_skb); |
1617 | out: | 1644 | out: |
1618 | if (release) | 1645 | if (release) |
1619 | release_ep_resources(ep); | 1646 | release_ep_resources(ep); |
@@ -2017,8 +2044,11 @@ int iwch_destroy_listen(struct iw_cm_id *cm_id) | |||
2017 | ep->com.rpl_done = 0; | 2044 | ep->com.rpl_done = 0; |
2018 | ep->com.rpl_err = 0; | 2045 | ep->com.rpl_err = 0; |
2019 | err = listen_stop(ep); | 2046 | err = listen_stop(ep); |
2047 | if (err) | ||
2048 | goto done; | ||
2020 | wait_event(ep->com.waitq, ep->com.rpl_done); | 2049 | wait_event(ep->com.waitq, ep->com.rpl_done); |
2021 | cxgb3_free_stid(ep->com.tdev, ep->stid); | 2050 | cxgb3_free_stid(ep->com.tdev, ep->stid); |
2051 | done: | ||
2022 | err = ep->com.rpl_err; | 2052 | err = ep->com.rpl_err; |
2023 | cm_id->rem_ref(cm_id); | 2053 | cm_id->rem_ref(cm_id); |
2024 | put_ep(&ep->com); | 2054 | put_ep(&ep->com); |
@@ -2030,12 +2060,22 @@ int iwch_ep_disconnect(struct iwch_ep *ep, int abrupt, gfp_t gfp) | |||
2030 | int ret=0; | 2060 | int ret=0; |
2031 | unsigned long flags; | 2061 | unsigned long flags; |
2032 | int close = 0; | 2062 | int close = 0; |
2063 | int fatal = 0; | ||
2064 | struct t3cdev *tdev; | ||
2065 | struct cxio_rdev *rdev; | ||
2033 | 2066 | ||
2034 | spin_lock_irqsave(&ep->com.lock, flags); | 2067 | spin_lock_irqsave(&ep->com.lock, flags); |
2035 | 2068 | ||
2036 | PDBG("%s ep %p state %s, abrupt %d\n", __func__, ep, | 2069 | PDBG("%s ep %p state %s, abrupt %d\n", __func__, ep, |
2037 | states[ep->com.state], abrupt); | 2070 | states[ep->com.state], abrupt); |
2038 | 2071 | ||
2072 | tdev = (struct t3cdev *)ep->com.tdev; | ||
2073 | rdev = (struct cxio_rdev *)tdev->ulp; | ||
2074 | if (cxio_fatal_error(rdev)) { | ||
2075 | fatal = 1; | ||
2076 | close_complete_upcall(ep); | ||
2077 | ep->com.state = DEAD; | ||
2078 | } | ||
2039 | switch (ep->com.state) { | 2079 | switch (ep->com.state) { |
2040 | case MPA_REQ_WAIT: | 2080 | case MPA_REQ_WAIT: |
2041 | case MPA_REQ_SENT: | 2081 | case MPA_REQ_SENT: |
@@ -2075,7 +2115,11 @@ int iwch_ep_disconnect(struct iwch_ep *ep, int abrupt, gfp_t gfp) | |||
2075 | ret = send_abort(ep, NULL, gfp); | 2115 | ret = send_abort(ep, NULL, gfp); |
2076 | else | 2116 | else |
2077 | ret = send_halfclose(ep, gfp); | 2117 | ret = send_halfclose(ep, gfp); |
2118 | if (ret) | ||
2119 | fatal = 1; | ||
2078 | } | 2120 | } |
2121 | if (fatal) | ||
2122 | release_ep_resources(ep); | ||
2079 | return ret; | 2123 | return ret; |
2080 | } | 2124 | } |
2081 | 2125 | ||
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.h b/drivers/infiniband/hw/cxgb3/iwch_cm.h index d7c7e09f0996..43c0aea7eadc 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_cm.h +++ b/drivers/infiniband/hw/cxgb3/iwch_cm.h | |||
@@ -147,6 +147,7 @@ enum iwch_ep_state { | |||
147 | enum iwch_ep_flags { | 147 | enum iwch_ep_flags { |
148 | PEER_ABORT_IN_PROGRESS = (1 << 0), | 148 | PEER_ABORT_IN_PROGRESS = (1 << 0), |
149 | ABORT_REQ_IN_PROGRESS = (1 << 1), | 149 | ABORT_REQ_IN_PROGRESS = (1 << 1), |
150 | RELEASE_RESOURCES = (1 << 2), | ||
150 | }; | 151 | }; |
151 | 152 | ||
152 | struct iwch_ep_common { | 153 | struct iwch_ep_common { |
@@ -161,6 +162,7 @@ struct iwch_ep_common { | |||
161 | wait_queue_head_t waitq; | 162 | wait_queue_head_t waitq; |
162 | int rpl_done; | 163 | int rpl_done; |
163 | int rpl_err; | 164 | int rpl_err; |
165 | u32 flags; | ||
164 | }; | 166 | }; |
165 | 167 | ||
166 | struct iwch_listen_ep { | 168 | struct iwch_listen_ep { |
@@ -188,7 +190,6 @@ struct iwch_ep { | |||
188 | u16 plen; | 190 | u16 plen; |
189 | u32 ird; | 191 | u32 ird; |
190 | u32 ord; | 192 | u32 ord; |
191 | u32 flags; | ||
192 | }; | 193 | }; |
193 | 194 | ||
194 | static inline struct iwch_ep *to_ep(struct iw_cm_id *cm_id) | 195 | static inline struct iwch_ep *to_ep(struct iw_cm_id *cm_id) |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_qp.c b/drivers/infiniband/hw/cxgb3/iwch_qp.c index c758fbd58478..2f546a625330 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_qp.c +++ b/drivers/infiniband/hw/cxgb3/iwch_qp.c | |||
@@ -751,7 +751,7 @@ int iwch_post_zb_read(struct iwch_qp *qhp) | |||
751 | wqe->send.wrh.gen_tid_len = cpu_to_be32(V_FW_RIWR_TID(qhp->ep->hwtid)| | 751 | wqe->send.wrh.gen_tid_len = cpu_to_be32(V_FW_RIWR_TID(qhp->ep->hwtid)| |
752 | V_FW_RIWR_LEN(flit_cnt)); | 752 | V_FW_RIWR_LEN(flit_cnt)); |
753 | skb->priority = CPL_PRIORITY_DATA; | 753 | skb->priority = CPL_PRIORITY_DATA; |
754 | return cxgb3_ofld_send(qhp->rhp->rdev.t3cdev_p, skb); | 754 | return iwch_cxgb3_ofld_send(qhp->rhp->rdev.t3cdev_p, skb); |
755 | } | 755 | } |
756 | 756 | ||
757 | /* | 757 | /* |
@@ -783,7 +783,7 @@ int iwch_post_terminate(struct iwch_qp *qhp, struct respQ_msg_t *rsp_msg) | |||
783 | V_FW_RIWR_FLAGS(T3_COMPLETION_FLAG | T3_NOTIFY_FLAG)); | 783 | V_FW_RIWR_FLAGS(T3_COMPLETION_FLAG | T3_NOTIFY_FLAG)); |
784 | wqe->send.wrh.gen_tid_len = cpu_to_be32(V_FW_RIWR_TID(qhp->ep->hwtid)); | 784 | wqe->send.wrh.gen_tid_len = cpu_to_be32(V_FW_RIWR_TID(qhp->ep->hwtid)); |
785 | skb->priority = CPL_PRIORITY_DATA; | 785 | skb->priority = CPL_PRIORITY_DATA; |
786 | return cxgb3_ofld_send(qhp->rhp->rdev.t3cdev_p, skb); | 786 | return iwch_cxgb3_ofld_send(qhp->rhp->rdev.t3cdev_p, skb); |
787 | } | 787 | } |
788 | 788 | ||
789 | /* | 789 | /* |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 2ccb9d31771f..ae3d7590346e 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -394,8 +394,7 @@ static int mlx4_ib_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) | |||
394 | PAGE_SIZE, vma->vm_page_prot)) | 394 | PAGE_SIZE, vma->vm_page_prot)) |
395 | return -EAGAIN; | 395 | return -EAGAIN; |
396 | } else if (vma->vm_pgoff == 1 && dev->dev->caps.bf_reg_size != 0) { | 396 | } else if (vma->vm_pgoff == 1 && dev->dev->caps.bf_reg_size != 0) { |
397 | /* FIXME want pgprot_writecombine() for BlueFlame pages */ | 397 | vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); |
398 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | ||
399 | 398 | ||
400 | if (io_remap_pfn_range(vma, vma->vm_start, | 399 | if (io_remap_pfn_range(vma, vma->vm_start, |
401 | to_mucontext(context)->uar.pfn + | 400 | to_mucontext(context)->uar.pfn + |
diff --git a/drivers/infiniband/hw/nes/nes.h b/drivers/infiniband/hw/nes/nes.h index 04b12ad23390..17621de54a9f 100644 --- a/drivers/infiniband/hw/nes/nes.h +++ b/drivers/infiniband/hw/nes/nes.h | |||
@@ -289,8 +289,8 @@ static inline __le32 get_crc_value(struct nes_v4_quad *nes_quad) | |||
289 | static inline void | 289 | static inline void |
290 | set_wqe_64bit_value(__le32 *wqe_words, u32 index, u64 value) | 290 | set_wqe_64bit_value(__le32 *wqe_words, u32 index, u64 value) |
291 | { | 291 | { |
292 | wqe_words[index] = cpu_to_le32((u32) ((unsigned long)value)); | 292 | wqe_words[index] = cpu_to_le32((u32) value); |
293 | wqe_words[index + 1] = cpu_to_le32((u32)(upper_32_bits((unsigned long)value))); | 293 | wqe_words[index + 1] = cpu_to_le32(upper_32_bits(value)); |
294 | } | 294 | } |
295 | 295 | ||
296 | static inline void | 296 | static inline void |
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c index 52425154acd4..dbd9a75474e3 100644 --- a/drivers/infiniband/hw/nes/nes_cm.c +++ b/drivers/infiniband/hw/nes/nes_cm.c | |||
@@ -426,6 +426,7 @@ int schedule_nes_timer(struct nes_cm_node *cm_node, struct sk_buff *skb, | |||
426 | if (type == NES_TIMER_TYPE_CLOSE) { | 426 | if (type == NES_TIMER_TYPE_CLOSE) { |
427 | new_send->timetosend += (HZ/10); | 427 | new_send->timetosend += (HZ/10); |
428 | if (cm_node->recv_entry) { | 428 | if (cm_node->recv_entry) { |
429 | kfree(new_send); | ||
429 | WARN_ON(1); | 430 | WARN_ON(1); |
430 | return -EINVAL; | 431 | return -EINVAL; |
431 | } | 432 | } |
@@ -445,8 +446,8 @@ int schedule_nes_timer(struct nes_cm_node *cm_node, struct sk_buff *skb, | |||
445 | if (ret != NETDEV_TX_OK) { | 446 | if (ret != NETDEV_TX_OK) { |
446 | nes_debug(NES_DBG_CM, "Error sending packet %p " | 447 | nes_debug(NES_DBG_CM, "Error sending packet %p " |
447 | "(jiffies = %lu)\n", new_send, jiffies); | 448 | "(jiffies = %lu)\n", new_send, jiffies); |
448 | atomic_dec(&new_send->skb->users); | ||
449 | new_send->timetosend = jiffies; | 449 | new_send->timetosend = jiffies; |
450 | ret = NETDEV_TX_OK; | ||
450 | } else { | 451 | } else { |
451 | cm_packets_sent++; | 452 | cm_packets_sent++; |
452 | if (!send_retrans) { | 453 | if (!send_retrans) { |
@@ -630,7 +631,6 @@ static void nes_cm_timer_tick(unsigned long pass) | |||
630 | nes_debug(NES_DBG_CM, "rexmit failed for " | 631 | nes_debug(NES_DBG_CM, "rexmit failed for " |
631 | "node=%p\n", cm_node); | 632 | "node=%p\n", cm_node); |
632 | cm_packets_bounced++; | 633 | cm_packets_bounced++; |
633 | atomic_dec(&send_entry->skb->users); | ||
634 | send_entry->retrycount--; | 634 | send_entry->retrycount--; |
635 | nexttimeout = jiffies + NES_SHORT_TIME; | 635 | nexttimeout = jiffies + NES_SHORT_TIME; |
636 | settimer = 1; | 636 | settimer = 1; |
@@ -666,11 +666,6 @@ static void nes_cm_timer_tick(unsigned long pass) | |||
666 | 666 | ||
667 | spin_unlock_irqrestore(&cm_node->retrans_list_lock, flags); | 667 | spin_unlock_irqrestore(&cm_node->retrans_list_lock, flags); |
668 | rem_ref_cm_node(cm_node->cm_core, cm_node); | 668 | rem_ref_cm_node(cm_node->cm_core, cm_node); |
669 | if (ret != NETDEV_TX_OK) { | ||
670 | nes_debug(NES_DBG_CM, "rexmit failed for cm_node=%p\n", | ||
671 | cm_node); | ||
672 | break; | ||
673 | } | ||
674 | } | 669 | } |
675 | 670 | ||
676 | if (settimer) { | 671 | if (settimer) { |
@@ -1262,7 +1257,6 @@ static int rem_ref_cm_node(struct nes_cm_core *cm_core, | |||
1262 | cm_node->nesqp = NULL; | 1257 | cm_node->nesqp = NULL; |
1263 | } | 1258 | } |
1264 | 1259 | ||
1265 | cm_node->freed = 1; | ||
1266 | kfree(cm_node); | 1260 | kfree(cm_node); |
1267 | return 0; | 1261 | return 0; |
1268 | } | 1262 | } |
@@ -1999,13 +1993,17 @@ static struct nes_cm_node *mini_cm_connect(struct nes_cm_core *cm_core, | |||
1999 | if (loopbackremotelistener == NULL) { | 1993 | if (loopbackremotelistener == NULL) { |
2000 | create_event(cm_node, NES_CM_EVENT_ABORTED); | 1994 | create_event(cm_node, NES_CM_EVENT_ABORTED); |
2001 | } else { | 1995 | } else { |
2002 | atomic_inc(&cm_loopbacks); | ||
2003 | loopback_cm_info = *cm_info; | 1996 | loopback_cm_info = *cm_info; |
2004 | loopback_cm_info.loc_port = cm_info->rem_port; | 1997 | loopback_cm_info.loc_port = cm_info->rem_port; |
2005 | loopback_cm_info.rem_port = cm_info->loc_port; | 1998 | loopback_cm_info.rem_port = cm_info->loc_port; |
2006 | loopback_cm_info.cm_id = loopbackremotelistener->cm_id; | 1999 | loopback_cm_info.cm_id = loopbackremotelistener->cm_id; |
2007 | loopbackremotenode = make_cm_node(cm_core, nesvnic, | 2000 | loopbackremotenode = make_cm_node(cm_core, nesvnic, |
2008 | &loopback_cm_info, loopbackremotelistener); | 2001 | &loopback_cm_info, loopbackremotelistener); |
2002 | if (!loopbackremotenode) { | ||
2003 | rem_ref_cm_node(cm_node->cm_core, cm_node); | ||
2004 | return NULL; | ||
2005 | } | ||
2006 | atomic_inc(&cm_loopbacks); | ||
2009 | loopbackremotenode->loopbackpartner = cm_node; | 2007 | loopbackremotenode->loopbackpartner = cm_node; |
2010 | loopbackremotenode->tcp_cntxt.rcv_wscale = | 2008 | loopbackremotenode->tcp_cntxt.rcv_wscale = |
2011 | NES_CM_DEFAULT_RCV_WND_SCALE; | 2009 | NES_CM_DEFAULT_RCV_WND_SCALE; |
@@ -2690,6 +2688,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
2690 | struct ib_mr *ibmr = NULL; | 2688 | struct ib_mr *ibmr = NULL; |
2691 | struct ib_phys_buf ibphysbuf; | 2689 | struct ib_phys_buf ibphysbuf; |
2692 | struct nes_pd *nespd; | 2690 | struct nes_pd *nespd; |
2691 | u64 tagged_offset; | ||
2693 | 2692 | ||
2694 | 2693 | ||
2695 | 2694 | ||
@@ -2755,10 +2754,11 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
2755 | ibphysbuf.addr = nesqp->ietf_frame_pbase; | 2754 | ibphysbuf.addr = nesqp->ietf_frame_pbase; |
2756 | ibphysbuf.size = conn_param->private_data_len + | 2755 | ibphysbuf.size = conn_param->private_data_len + |
2757 | sizeof(struct ietf_mpa_frame); | 2756 | sizeof(struct ietf_mpa_frame); |
2757 | tagged_offset = (u64)(unsigned long)nesqp->ietf_frame; | ||
2758 | ibmr = nesibdev->ibdev.reg_phys_mr((struct ib_pd *)nespd, | 2758 | ibmr = nesibdev->ibdev.reg_phys_mr((struct ib_pd *)nespd, |
2759 | &ibphysbuf, 1, | 2759 | &ibphysbuf, 1, |
2760 | IB_ACCESS_LOCAL_WRITE, | 2760 | IB_ACCESS_LOCAL_WRITE, |
2761 | (u64 *)&nesqp->ietf_frame); | 2761 | &tagged_offset); |
2762 | if (!ibmr) { | 2762 | if (!ibmr) { |
2763 | nes_debug(NES_DBG_CM, "Unable to register memory region" | 2763 | nes_debug(NES_DBG_CM, "Unable to register memory region" |
2764 | "for lSMM for cm_node = %p \n", | 2764 | "for lSMM for cm_node = %p \n", |
@@ -2782,7 +2782,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
2782 | sizeof(struct ietf_mpa_frame)); | 2782 | sizeof(struct ietf_mpa_frame)); |
2783 | set_wqe_64bit_value(wqe->wqe_words, | 2783 | set_wqe_64bit_value(wqe->wqe_words, |
2784 | NES_IWARP_SQ_WQE_FRAG0_LOW_IDX, | 2784 | NES_IWARP_SQ_WQE_FRAG0_LOW_IDX, |
2785 | (u64)nesqp->ietf_frame); | 2785 | (u64)(unsigned long)nesqp->ietf_frame); |
2786 | wqe->wqe_words[NES_IWARP_SQ_WQE_LENGTH0_IDX] = | 2786 | wqe->wqe_words[NES_IWARP_SQ_WQE_LENGTH0_IDX] = |
2787 | cpu_to_le32(conn_param->private_data_len + | 2787 | cpu_to_le32(conn_param->private_data_len + |
2788 | sizeof(struct ietf_mpa_frame)); | 2788 | sizeof(struct ietf_mpa_frame)); |
diff --git a/drivers/infiniband/hw/nes/nes_cm.h b/drivers/infiniband/hw/nes/nes_cm.h index d5f778202eb7..80bba1892571 100644 --- a/drivers/infiniband/hw/nes/nes_cm.h +++ b/drivers/infiniband/hw/nes/nes_cm.h | |||
@@ -298,7 +298,6 @@ struct nes_cm_node { | |||
298 | struct nes_vnic *nesvnic; | 298 | struct nes_vnic *nesvnic; |
299 | int apbvt_set; | 299 | int apbvt_set; |
300 | int accept_pend; | 300 | int accept_pend; |
301 | int freed; | ||
302 | struct list_head timer_entry; | 301 | struct list_head timer_entry; |
303 | struct list_head reset_entry; | 302 | struct list_head reset_entry; |
304 | struct nes_qp *nesqp; | 303 | struct nes_qp *nesqp; |
diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c index 52e734042b8e..d6fc9ae44062 100644 --- a/drivers/infiniband/hw/nes/nes_hw.c +++ b/drivers/infiniband/hw/nes/nes_hw.c | |||
@@ -46,6 +46,10 @@ static unsigned int nes_lro_max_aggr = NES_LRO_MAX_AGGR; | |||
46 | module_param(nes_lro_max_aggr, uint, 0444); | 46 | module_param(nes_lro_max_aggr, uint, 0444); |
47 | MODULE_PARM_DESC(nes_lro_max_aggr, "NIC LRO max packet aggregation"); | 47 | MODULE_PARM_DESC(nes_lro_max_aggr, "NIC LRO max packet aggregation"); |
48 | 48 | ||
49 | static int wide_ppm_offset; | ||
50 | module_param(wide_ppm_offset, int, 0644); | ||
51 | MODULE_PARM_DESC(wide_ppm_offset, "Increase CX4 interface clock ppm offset, 0=100ppm (default), 1=300ppm"); | ||
52 | |||
49 | static u32 crit_err_count; | 53 | static u32 crit_err_count; |
50 | u32 int_mod_timer_init; | 54 | u32 int_mod_timer_init; |
51 | u32 int_mod_cq_depth_256; | 55 | u32 int_mod_cq_depth_256; |
@@ -546,8 +550,11 @@ struct nes_adapter *nes_init_adapter(struct nes_device *nesdev, u8 hw_rev) { | |||
546 | msleep(1); | 550 | msleep(1); |
547 | } | 551 | } |
548 | if (int_cnt > 1) { | 552 | if (int_cnt > 1) { |
553 | u32 sds; | ||
549 | spin_lock_irqsave(&nesadapter->phy_lock, flags); | 554 | spin_lock_irqsave(&nesadapter->phy_lock, flags); |
550 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, 0x0000F088); | 555 | sds = nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1); |
556 | sds |= 0x00000040; | ||
557 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, sds); | ||
551 | mh_detected++; | 558 | mh_detected++; |
552 | reset_value = nes_read32(nesdev->regs+NES_SOFTWARE_RESET); | 559 | reset_value = nes_read32(nesdev->regs+NES_SOFTWARE_RESET); |
553 | reset_value |= 0x0000003d; | 560 | reset_value |= 0x0000003d; |
@@ -736,39 +743,49 @@ static int nes_init_serdes(struct nes_device *nesdev, u8 hw_rev, u8 port_count, | |||
736 | { | 743 | { |
737 | int i; | 744 | int i; |
738 | u32 u32temp; | 745 | u32 u32temp; |
739 | u32 serdes_common_control; | 746 | u32 sds; |
740 | 747 | ||
741 | if (hw_rev != NE020_REV) { | 748 | if (hw_rev != NE020_REV) { |
742 | /* init serdes 0 */ | 749 | /* init serdes 0 */ |
750 | if (wide_ppm_offset && (nesadapter->phy_type[0] == NES_PHY_TYPE_CX4)) | ||
751 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_CDR_CONTROL0, 0x000FFFAA); | ||
752 | else | ||
753 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_CDR_CONTROL0, 0x000000FF); | ||
743 | 754 | ||
744 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_CDR_CONTROL0, 0x000000FF); | ||
745 | if (nesadapter->phy_type[0] == NES_PHY_TYPE_PUMA_1G) { | 755 | if (nesadapter->phy_type[0] == NES_PHY_TYPE_PUMA_1G) { |
746 | serdes_common_control = nes_read_indexed(nesdev, | 756 | sds = nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL0); |
747 | NES_IDX_ETH_SERDES_COMMON_CONTROL0); | 757 | sds |= 0x00000100; |
748 | serdes_common_control |= 0x000000100; | 758 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL0, sds); |
749 | nes_write_indexed(nesdev, | ||
750 | NES_IDX_ETH_SERDES_COMMON_CONTROL0, | ||
751 | serdes_common_control); | ||
752 | } else if (!OneG_Mode) { | ||
753 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_TX_HIGHZ_LANE_MODE0, 0x11110000); | ||
754 | } | 759 | } |
755 | if (((port_count > 1) && | 760 | if (!OneG_Mode) |
756 | (nesadapter->phy_type[0] != NES_PHY_TYPE_PUMA_1G)) || | 761 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_TX_HIGHZ_LANE_MODE0, 0x11110000); |
757 | ((port_count > 2) && | 762 | |
758 | (nesadapter->phy_type[0] == NES_PHY_TYPE_PUMA_1G))) { | 763 | if (port_count < 2) |
759 | /* init serdes 1 */ | 764 | return 0; |
760 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_CDR_CONTROL1, 0x000000FF); | 765 | |
761 | if (nesadapter->phy_type[0] == NES_PHY_TYPE_PUMA_1G) { | 766 | /* init serdes 1 */ |
762 | serdes_common_control = nes_read_indexed(nesdev, | 767 | switch (nesadapter->phy_type[1]) { |
763 | NES_IDX_ETH_SERDES_COMMON_CONTROL1); | 768 | case NES_PHY_TYPE_ARGUS: |
764 | serdes_common_control |= 0x000000100; | 769 | case NES_PHY_TYPE_SFP_D: |
765 | nes_write_indexed(nesdev, | 770 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_TX_EMP0, 0x00000000); |
766 | NES_IDX_ETH_SERDES_COMMON_CONTROL1, | 771 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_TX_EMP1, 0x00000000); |
767 | serdes_common_control); | 772 | break; |
768 | } else if (!OneG_Mode) { | 773 | case NES_PHY_TYPE_CX4: |
769 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_TX_HIGHZ_LANE_MODE1, 0x11110000); | 774 | sds = nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1); |
770 | } | 775 | sds &= 0xFFFFFFBF; |
776 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, sds); | ||
777 | if (wide_ppm_offset) | ||
778 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_CDR_CONTROL1, 0x000FFFAA); | ||
779 | else | ||
780 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_CDR_CONTROL1, 0x000000FF); | ||
781 | break; | ||
782 | case NES_PHY_TYPE_PUMA_1G: | ||
783 | sds = nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1); | ||
784 | sds |= 0x000000100; | ||
785 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL1, sds); | ||
771 | } | 786 | } |
787 | if (!OneG_Mode) | ||
788 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_TX_HIGHZ_LANE_MODE1, 0x11110000); | ||
772 | } else { | 789 | } else { |
773 | /* init serdes 0 */ | 790 | /* init serdes 0 */ |
774 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL0, 0x00000008); | 791 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL0, 0x00000008); |
@@ -1259,203 +1276,162 @@ int nes_init_phy(struct nes_device *nesdev) | |||
1259 | { | 1276 | { |
1260 | struct nes_adapter *nesadapter = nesdev->nesadapter; | 1277 | struct nes_adapter *nesadapter = nesdev->nesadapter; |
1261 | u32 counter = 0; | 1278 | u32 counter = 0; |
1262 | u32 sds_common_control0; | 1279 | u32 sds; |
1263 | u32 mac_index = nesdev->mac_index; | 1280 | u32 mac_index = nesdev->mac_index; |
1264 | u32 tx_config = 0; | 1281 | u32 tx_config = 0; |
1265 | u16 phy_data; | 1282 | u16 phy_data; |
1266 | u32 temp_phy_data = 0; | 1283 | u32 temp_phy_data = 0; |
1267 | u32 temp_phy_data2 = 0; | 1284 | u32 temp_phy_data2 = 0; |
1268 | u32 i = 0; | 1285 | u8 phy_type = nesadapter->phy_type[mac_index]; |
1286 | u8 phy_index = nesadapter->phy_index[mac_index]; | ||
1269 | 1287 | ||
1270 | if ((nesadapter->OneG_Mode) && | 1288 | if ((nesadapter->OneG_Mode) && |
1271 | (nesadapter->phy_type[mac_index] != NES_PHY_TYPE_PUMA_1G)) { | 1289 | (phy_type != NES_PHY_TYPE_PUMA_1G)) { |
1272 | nes_debug(NES_DBG_PHY, "1G PHY, mac_index = %d.\n", mac_index); | 1290 | nes_debug(NES_DBG_PHY, "1G PHY, mac_index = %d.\n", mac_index); |
1273 | if (nesadapter->phy_type[mac_index] == NES_PHY_TYPE_1G) { | 1291 | if (phy_type == NES_PHY_TYPE_1G) { |
1274 | printk(PFX "%s: Programming mdc config for 1G\n", __func__); | ||
1275 | tx_config = nes_read_indexed(nesdev, NES_IDX_MAC_TX_CONFIG); | 1292 | tx_config = nes_read_indexed(nesdev, NES_IDX_MAC_TX_CONFIG); |
1276 | tx_config &= 0xFFFFFFE3; | 1293 | tx_config &= 0xFFFFFFE3; |
1277 | tx_config |= 0x04; | 1294 | tx_config |= 0x04; |
1278 | nes_write_indexed(nesdev, NES_IDX_MAC_TX_CONFIG, tx_config); | 1295 | nes_write_indexed(nesdev, NES_IDX_MAC_TX_CONFIG, tx_config); |
1279 | } | 1296 | } |
1280 | 1297 | ||
1281 | nes_read_1G_phy_reg(nesdev, 1, nesadapter->phy_index[mac_index], &phy_data); | 1298 | nes_read_1G_phy_reg(nesdev, 1, phy_index, &phy_data); |
1282 | nes_debug(NES_DBG_PHY, "Phy data from register 1 phy address %u = 0x%X.\n", | 1299 | nes_write_1G_phy_reg(nesdev, 23, phy_index, 0xb000); |
1283 | nesadapter->phy_index[mac_index], phy_data); | ||
1284 | nes_write_1G_phy_reg(nesdev, 23, nesadapter->phy_index[mac_index], 0xb000); | ||
1285 | 1300 | ||
1286 | /* Reset the PHY */ | 1301 | /* Reset the PHY */ |
1287 | nes_write_1G_phy_reg(nesdev, 0, nesadapter->phy_index[mac_index], 0x8000); | 1302 | nes_write_1G_phy_reg(nesdev, 0, phy_index, 0x8000); |
1288 | udelay(100); | 1303 | udelay(100); |
1289 | counter = 0; | 1304 | counter = 0; |
1290 | do { | 1305 | do { |
1291 | nes_read_1G_phy_reg(nesdev, 0, nesadapter->phy_index[mac_index], &phy_data); | 1306 | nes_read_1G_phy_reg(nesdev, 0, phy_index, &phy_data); |
1292 | nes_debug(NES_DBG_PHY, "Phy data from register 0 = 0x%X.\n", phy_data); | 1307 | if (counter++ > 100) |
1293 | if (counter++ > 100) break; | 1308 | break; |
1294 | } while (phy_data & 0x8000); | 1309 | } while (phy_data & 0x8000); |
1295 | 1310 | ||
1296 | /* Setting no phy loopback */ | 1311 | /* Setting no phy loopback */ |
1297 | phy_data &= 0xbfff; | 1312 | phy_data &= 0xbfff; |
1298 | phy_data |= 0x1140; | 1313 | phy_data |= 0x1140; |
1299 | nes_write_1G_phy_reg(nesdev, 0, nesadapter->phy_index[mac_index], phy_data); | 1314 | nes_write_1G_phy_reg(nesdev, 0, phy_index, phy_data); |
1300 | nes_read_1G_phy_reg(nesdev, 0, nesadapter->phy_index[mac_index], &phy_data); | 1315 | nes_read_1G_phy_reg(nesdev, 0, phy_index, &phy_data); |
1301 | nes_debug(NES_DBG_PHY, "Phy data from register 0 = 0x%X.\n", phy_data); | 1316 | nes_read_1G_phy_reg(nesdev, 0x17, phy_index, &phy_data); |
1302 | 1317 | nes_read_1G_phy_reg(nesdev, 0x1e, phy_index, &phy_data); | |
1303 | nes_read_1G_phy_reg(nesdev, 0x17, nesadapter->phy_index[mac_index], &phy_data); | ||
1304 | nes_debug(NES_DBG_PHY, "Phy data from register 0x17 = 0x%X.\n", phy_data); | ||
1305 | |||
1306 | nes_read_1G_phy_reg(nesdev, 0x1e, nesadapter->phy_index[mac_index], &phy_data); | ||
1307 | nes_debug(NES_DBG_PHY, "Phy data from register 0x1e = 0x%X.\n", phy_data); | ||
1308 | 1318 | ||
1309 | /* Setting the interrupt mask */ | 1319 | /* Setting the interrupt mask */ |
1310 | nes_read_1G_phy_reg(nesdev, 0x19, nesadapter->phy_index[mac_index], &phy_data); | 1320 | nes_read_1G_phy_reg(nesdev, 0x19, phy_index, &phy_data); |
1311 | nes_debug(NES_DBG_PHY, "Phy data from register 0x19 = 0x%X.\n", phy_data); | 1321 | nes_write_1G_phy_reg(nesdev, 0x19, phy_index, 0xffee); |
1312 | nes_write_1G_phy_reg(nesdev, 0x19, nesadapter->phy_index[mac_index], 0xffee); | 1322 | nes_read_1G_phy_reg(nesdev, 0x19, phy_index, &phy_data); |
1313 | |||
1314 | nes_read_1G_phy_reg(nesdev, 0x19, nesadapter->phy_index[mac_index], &phy_data); | ||
1315 | nes_debug(NES_DBG_PHY, "Phy data from register 0x19 = 0x%X.\n", phy_data); | ||
1316 | 1323 | ||
1317 | /* turning on flow control */ | 1324 | /* turning on flow control */ |
1318 | nes_read_1G_phy_reg(nesdev, 4, nesadapter->phy_index[mac_index], &phy_data); | 1325 | nes_read_1G_phy_reg(nesdev, 4, phy_index, &phy_data); |
1319 | nes_debug(NES_DBG_PHY, "Phy data from register 0x4 = 0x%X.\n", phy_data); | 1326 | nes_write_1G_phy_reg(nesdev, 4, phy_index, (phy_data & ~(0x03E0)) | 0xc00); |
1320 | nes_write_1G_phy_reg(nesdev, 4, nesadapter->phy_index[mac_index], | 1327 | nes_read_1G_phy_reg(nesdev, 4, phy_index, &phy_data); |
1321 | (phy_data & ~(0x03E0)) | 0xc00); | ||
1322 | /* nes_write_1G_phy_reg(nesdev, 4, nesadapter->phy_index[mac_index], | ||
1323 | phy_data | 0xc00); */ | ||
1324 | nes_read_1G_phy_reg(nesdev, 4, nesadapter->phy_index[mac_index], &phy_data); | ||
1325 | nes_debug(NES_DBG_PHY, "Phy data from register 0x4 = 0x%X.\n", phy_data); | ||
1326 | |||
1327 | nes_read_1G_phy_reg(nesdev, 9, nesadapter->phy_index[mac_index], &phy_data); | ||
1328 | nes_debug(NES_DBG_PHY, "Phy data from register 0x9 = 0x%X.\n", phy_data); | ||
1329 | /* Clear Half duplex */ | ||
1330 | nes_write_1G_phy_reg(nesdev, 9, nesadapter->phy_index[mac_index], | ||
1331 | phy_data & ~(0x0100)); | ||
1332 | nes_read_1G_phy_reg(nesdev, 9, nesadapter->phy_index[mac_index], &phy_data); | ||
1333 | nes_debug(NES_DBG_PHY, "Phy data from register 0x9 = 0x%X.\n", phy_data); | ||
1334 | |||
1335 | nes_read_1G_phy_reg(nesdev, 0, nesadapter->phy_index[mac_index], &phy_data); | ||
1336 | nes_write_1G_phy_reg(nesdev, 0, nesadapter->phy_index[mac_index], phy_data | 0x0300); | ||
1337 | } else { | ||
1338 | if ((nesadapter->phy_type[mac_index] == NES_PHY_TYPE_IRIS) || | ||
1339 | (nesadapter->phy_type[mac_index] == NES_PHY_TYPE_ARGUS)) { | ||
1340 | /* setup 10G MDIO operation */ | ||
1341 | tx_config = nes_read_indexed(nesdev, NES_IDX_MAC_TX_CONFIG); | ||
1342 | tx_config &= 0xFFFFFFE3; | ||
1343 | tx_config |= 0x15; | ||
1344 | nes_write_indexed(nesdev, NES_IDX_MAC_TX_CONFIG, tx_config); | ||
1345 | } | ||
1346 | if ((nesadapter->phy_type[mac_index] == NES_PHY_TYPE_ARGUS)) { | ||
1347 | nes_read_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 0x3, 0xd7ee); | ||
1348 | 1328 | ||
1349 | temp_phy_data = (u16)nes_read_indexed(nesdev, NES_IDX_MAC_MDIO_CONTROL); | 1329 | /* Clear Half duplex */ |
1350 | mdelay(10); | 1330 | nes_read_1G_phy_reg(nesdev, 9, phy_index, &phy_data); |
1351 | nes_read_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 0x3, 0xd7ee); | 1331 | nes_write_1G_phy_reg(nesdev, 9, phy_index, phy_data & ~(0x0100)); |
1352 | temp_phy_data2 = (u16)nes_read_indexed(nesdev, NES_IDX_MAC_MDIO_CONTROL); | 1332 | nes_read_1G_phy_reg(nesdev, 9, phy_index, &phy_data); |
1353 | 1333 | ||
1354 | /* | 1334 | nes_read_1G_phy_reg(nesdev, 0, phy_index, &phy_data); |
1355 | * if firmware is already running (like from a | 1335 | nes_write_1G_phy_reg(nesdev, 0, phy_index, phy_data | 0x0300); |
1356 | * driver un-load/load, don't do anything. | ||
1357 | */ | ||
1358 | if (temp_phy_data == temp_phy_data2) { | ||
1359 | /* configure QT2505 AMCC PHY */ | ||
1360 | nes_write_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 0x1, 0x0000, 0x8000); | ||
1361 | nes_write_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 0x1, 0xc300, 0x0000); | ||
1362 | nes_write_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 0x1, 0xc302, 0x0044); | ||
1363 | nes_write_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 0x1, 0xc318, 0x0052); | ||
1364 | nes_write_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 0x1, 0xc319, 0x0008); | ||
1365 | nes_write_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 0x1, 0xc31a, 0x0098); | ||
1366 | nes_write_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 0x3, 0x0026, 0x0E00); | ||
1367 | nes_write_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 0x3, 0x0027, 0x0001); | ||
1368 | nes_write_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 0x3, 0x0028, 0xA528); | ||
1369 | 1336 | ||
1370 | /* | 1337 | return 0; |
1371 | * remove micro from reset; chip boots from ROM, | 1338 | } |
1372 | * uploads EEPROM f/w image, uC executes f/w | ||
1373 | */ | ||
1374 | nes_write_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 0x1, 0xc300, 0x0002); | ||
1375 | 1339 | ||
1376 | /* | 1340 | if ((phy_type == NES_PHY_TYPE_IRIS) || |
1377 | * wait for heart beat to start to | 1341 | (phy_type == NES_PHY_TYPE_ARGUS) || |
1378 | * know loading is done | 1342 | (phy_type == NES_PHY_TYPE_SFP_D)) { |
1379 | */ | 1343 | /* setup 10G MDIO operation */ |
1380 | counter = 0; | 1344 | tx_config = nes_read_indexed(nesdev, NES_IDX_MAC_TX_CONFIG); |
1381 | do { | 1345 | tx_config &= 0xFFFFFFE3; |
1382 | nes_read_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 0x3, 0xd7ee); | 1346 | tx_config |= 0x15; |
1383 | temp_phy_data = (u16)nes_read_indexed(nesdev, NES_IDX_MAC_MDIO_CONTROL); | 1347 | nes_write_indexed(nesdev, NES_IDX_MAC_TX_CONFIG, tx_config); |
1384 | if (counter++ > 1000) { | 1348 | } |
1385 | nes_debug(NES_DBG_PHY, "AMCC PHY- breaking from heartbeat check <this is bad!!!> \n"); | 1349 | if ((phy_type == NES_PHY_TYPE_ARGUS) || |
1386 | break; | 1350 | (phy_type == NES_PHY_TYPE_SFP_D)) { |
1387 | } | 1351 | /* Check firmware heartbeat */ |
1388 | mdelay(100); | 1352 | nes_read_10G_phy_reg(nesdev, phy_index, 0x3, 0xd7ee); |
1389 | nes_read_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 0x3, 0xd7ee); | 1353 | temp_phy_data = (u16)nes_read_indexed(nesdev, NES_IDX_MAC_MDIO_CONTROL); |
1390 | temp_phy_data2 = (u16)nes_read_indexed(nesdev, NES_IDX_MAC_MDIO_CONTROL); | 1354 | udelay(1500); |
1391 | } while ((temp_phy_data2 == temp_phy_data)); | 1355 | nes_read_10G_phy_reg(nesdev, phy_index, 0x3, 0xd7ee); |
1356 | temp_phy_data2 = (u16)nes_read_indexed(nesdev, NES_IDX_MAC_MDIO_CONTROL); | ||
1357 | |||
1358 | if (temp_phy_data != temp_phy_data2) | ||
1359 | return 0; | ||
1392 | 1360 | ||
1393 | /* | 1361 | /* no heartbeat, configure the PHY */ |
1394 | * wait for tracking to start to know | 1362 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0x0000, 0x8000); |
1395 | * f/w is good to go | 1363 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc300, 0x0000); |
1396 | */ | 1364 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc316, 0x000A); |
1397 | counter = 0; | 1365 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc318, 0x0052); |
1398 | do { | 1366 | if (phy_type == NES_PHY_TYPE_ARGUS) { |
1399 | nes_read_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 0x3, 0xd7fd); | 1367 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc302, 0x000C); |
1400 | temp_phy_data = (u16)nes_read_indexed(nesdev, NES_IDX_MAC_MDIO_CONTROL); | 1368 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc319, 0x0008); |
1401 | if (counter++ > 1000) { | 1369 | } else { |
1402 | nes_debug(NES_DBG_PHY, "AMCC PHY- breaking from status check <this is bad!!!> \n"); | 1370 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc302, 0x0004); |
1403 | break; | 1371 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc319, 0x0038); |
1404 | } | 1372 | } |
1405 | mdelay(1000); | 1373 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc31a, 0x0098); |
1406 | /* | 1374 | nes_write_10G_phy_reg(nesdev, phy_index, 0x3, 0x0026, 0x0E00); |
1407 | * nes_debug(NES_DBG_PHY, "AMCC PHY- phy_status not ready yet = 0x%02X\n", | 1375 | nes_write_10G_phy_reg(nesdev, phy_index, 0x3, 0x0027, 0x0001); |
1408 | * temp_phy_data); | ||
1409 | */ | ||
1410 | } while (((temp_phy_data & 0xff) != 0x50) && ((temp_phy_data & 0xff) != 0x70)); | ||
1411 | |||
1412 | /* set LOS Control invert RXLOSB_I_PADINV */ | ||
1413 | nes_write_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 0x1, 0xd003, 0x0000); | ||
1414 | /* set LOS Control to mask of RXLOSB_I */ | ||
1415 | nes_write_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 0x1, 0xc314, 0x0042); | ||
1416 | /* set LED1 to input mode (LED1 and LED2 share same LED) */ | ||
1417 | nes_write_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 0x1, 0xd006, 0x0007); | ||
1418 | /* set LED2 to RX link_status and activity */ | ||
1419 | nes_write_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 0x1, 0xd007, 0x000A); | ||
1420 | /* set LED3 to RX link_status */ | ||
1421 | nes_write_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 0x1, 0xd008, 0x0009); | ||
1422 | 1376 | ||
1423 | /* | 1377 | /* setup LEDs */ |
1424 | * reset the res-calibration on t2 | 1378 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xd006, 0x0007); |
1425 | * serdes; ensures it is stable after | 1379 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xd007, 0x000A); |
1426 | * the amcc phy is stable | 1380 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xd008, 0x0009); |
1427 | */ | ||
1428 | 1381 | ||
1429 | sds_common_control0 = nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL0); | 1382 | nes_write_10G_phy_reg(nesdev, phy_index, 0x3, 0x0028, 0xA528); |
1430 | sds_common_control0 |= 0x1; | ||
1431 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL0, sds_common_control0); | ||
1432 | 1383 | ||
1433 | /* release the res-calibration reset */ | 1384 | /* Bring PHY out of reset */ |
1434 | sds_common_control0 &= 0xfffffffe; | 1385 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc300, 0x0002); |
1435 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL0, sds_common_control0); | ||
1436 | 1386 | ||
1437 | i = 0; | 1387 | /* Check for heartbeat */ |
1438 | while (((nes_read32(nesdev->regs + NES_SOFTWARE_RESET) & 0x00000040) != 0x00000040) | 1388 | counter = 0; |
1439 | && (i++ < 5000)) { | 1389 | mdelay(690); |
1440 | /* mdelay(1); */ | 1390 | nes_read_10G_phy_reg(nesdev, phy_index, 0x3, 0xd7ee); |
1441 | } | 1391 | temp_phy_data = (u16)nes_read_indexed(nesdev, NES_IDX_MAC_MDIO_CONTROL); |
1392 | do { | ||
1393 | if (counter++ > 150) { | ||
1394 | nes_debug(NES_DBG_PHY, "No PHY heartbeat\n"); | ||
1395 | break; | ||
1396 | } | ||
1397 | mdelay(1); | ||
1398 | nes_read_10G_phy_reg(nesdev, phy_index, 0x3, 0xd7ee); | ||
1399 | temp_phy_data2 = (u16)nes_read_indexed(nesdev, NES_IDX_MAC_MDIO_CONTROL); | ||
1400 | } while ((temp_phy_data2 == temp_phy_data)); | ||
1442 | 1401 | ||
1443 | /* | 1402 | /* wait for tracking */ |
1444 | * wait for link train done before moving on, | 1403 | counter = 0; |
1445 | * or will get an interupt storm | 1404 | do { |
1446 | */ | 1405 | nes_read_10G_phy_reg(nesdev, phy_index, 0x3, 0xd7fd); |
1447 | counter = 0; | 1406 | temp_phy_data = (u16)nes_read_indexed(nesdev, NES_IDX_MAC_MDIO_CONTROL); |
1448 | do { | 1407 | if (counter++ > 300) { |
1449 | temp_phy_data = nes_read_indexed(nesdev, NES_IDX_PHY_PCS_CONTROL_STATUS0 + | 1408 | nes_debug(NES_DBG_PHY, "PHY did not track\n"); |
1450 | (0x200 * (nesdev->mac_index & 1))); | 1409 | break; |
1451 | if (counter++ > 1000) { | ||
1452 | nes_debug(NES_DBG_PHY, "AMCC PHY- breaking from link train wait <this is bad, link didnt train!!!>\n"); | ||
1453 | break; | ||
1454 | } | ||
1455 | mdelay(1); | ||
1456 | } while (((temp_phy_data & 0x0f1f0000) != 0x0f0f0000)); | ||
1457 | } | 1410 | } |
1458 | } | 1411 | mdelay(10); |
1412 | } while (((temp_phy_data & 0xff) != 0x50) && ((temp_phy_data & 0xff) != 0x70)); | ||
1413 | |||
1414 | /* setup signal integrity */ | ||
1415 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xd003, 0x0000); | ||
1416 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xF00D, 0x00FE); | ||
1417 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xF00E, 0x0032); | ||
1418 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xF00F, 0x0002); | ||
1419 | nes_write_10G_phy_reg(nesdev, phy_index, 0x1, 0xc314, 0x0063); | ||
1420 | |||
1421 | /* reset serdes */ | ||
1422 | sds = nes_read_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL0 + | ||
1423 | mac_index * 0x200); | ||
1424 | sds |= 0x1; | ||
1425 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL0 + | ||
1426 | mac_index * 0x200, sds); | ||
1427 | sds &= 0xfffffffe; | ||
1428 | nes_write_indexed(nesdev, NES_IDX_ETH_SERDES_COMMON_CONTROL0 + | ||
1429 | mac_index * 0x200, sds); | ||
1430 | |||
1431 | counter = 0; | ||
1432 | while (((nes_read32(nesdev->regs + NES_SOFTWARE_RESET) & 0x00000040) != 0x00000040) | ||
1433 | && (counter++ < 5000)) | ||
1434 | ; | ||
1459 | } | 1435 | } |
1460 | return 0; | 1436 | return 0; |
1461 | } | 1437 | } |
@@ -2359,6 +2335,7 @@ static void nes_process_mac_intr(struct nes_device *nesdev, u32 mac_number) | |||
2359 | u16 temp_phy_data; | 2335 | u16 temp_phy_data; |
2360 | u32 pcs_val = 0x0f0f0000; | 2336 | u32 pcs_val = 0x0f0f0000; |
2361 | u32 pcs_mask = 0x0f1f0000; | 2337 | u32 pcs_mask = 0x0f1f0000; |
2338 | u32 cdr_ctrl; | ||
2362 | 2339 | ||
2363 | spin_lock_irqsave(&nesadapter->phy_lock, flags); | 2340 | spin_lock_irqsave(&nesadapter->phy_lock, flags); |
2364 | if (nesadapter->mac_sw_state[mac_number] != NES_MAC_SW_IDLE) { | 2341 | if (nesadapter->mac_sw_state[mac_number] != NES_MAC_SW_IDLE) { |
@@ -2473,6 +2450,7 @@ static void nes_process_mac_intr(struct nes_device *nesdev, u32 mac_number) | |||
2473 | break; | 2450 | break; |
2474 | 2451 | ||
2475 | case NES_PHY_TYPE_ARGUS: | 2452 | case NES_PHY_TYPE_ARGUS: |
2453 | case NES_PHY_TYPE_SFP_D: | ||
2476 | /* clear the alarms */ | 2454 | /* clear the alarms */ |
2477 | nes_read_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 4, 0x0008); | 2455 | nes_read_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 4, 0x0008); |
2478 | nes_read_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 4, 0xc001); | 2456 | nes_read_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 4, 0xc001); |
@@ -2483,19 +2461,18 @@ static void nes_process_mac_intr(struct nes_device *nesdev, u32 mac_number) | |||
2483 | nes_read_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 1, 0x9004); | 2461 | nes_read_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 1, 0x9004); |
2484 | nes_read_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 1, 0x9005); | 2462 | nes_read_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 1, 0x9005); |
2485 | /* check link status */ | 2463 | /* check link status */ |
2486 | nes_read_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 1, 1); | 2464 | nes_read_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 1, 0x9003); |
2487 | temp_phy_data = (u16)nes_read_indexed(nesdev, NES_IDX_MAC_MDIO_CONTROL); | 2465 | temp_phy_data = (u16)nes_read_indexed(nesdev, NES_IDX_MAC_MDIO_CONTROL); |
2488 | u32temp = 100; | ||
2489 | do { | ||
2490 | nes_read_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 1, 1); | ||
2491 | 2466 | ||
2492 | phy_data = (u16)nes_read_indexed(nesdev, NES_IDX_MAC_MDIO_CONTROL); | 2467 | nes_read_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 3, 0x0021); |
2493 | if ((phy_data == temp_phy_data) || (!(--u32temp))) | 2468 | nes_read_indexed(nesdev, NES_IDX_MAC_MDIO_CONTROL); |
2494 | break; | 2469 | nes_read_10G_phy_reg(nesdev, nesadapter->phy_index[mac_index], 3, 0x0021); |
2495 | temp_phy_data = phy_data; | 2470 | phy_data = (u16)nes_read_indexed(nesdev, NES_IDX_MAC_MDIO_CONTROL); |
2496 | } while (1); | 2471 | |
2472 | phy_data = (!temp_phy_data && (phy_data == 0x8000)) ? 0x4 : 0x0; | ||
2473 | |||
2497 | nes_debug(NES_DBG_PHY, "%s: Phy data = 0x%04X, link was %s.\n", | 2474 | nes_debug(NES_DBG_PHY, "%s: Phy data = 0x%04X, link was %s.\n", |
2498 | __func__, phy_data, nesadapter->mac_link_down ? "DOWN" : "UP"); | 2475 | __func__, phy_data, nesadapter->mac_link_down[mac_index] ? "DOWN" : "UP"); |
2499 | break; | 2476 | break; |
2500 | 2477 | ||
2501 | case NES_PHY_TYPE_PUMA_1G: | 2478 | case NES_PHY_TYPE_PUMA_1G: |
@@ -2511,6 +2488,17 @@ static void nes_process_mac_intr(struct nes_device *nesdev, u32 mac_number) | |||
2511 | } | 2488 | } |
2512 | 2489 | ||
2513 | if (phy_data & 0x0004) { | 2490 | if (phy_data & 0x0004) { |
2491 | if (wide_ppm_offset && | ||
2492 | (nesadapter->phy_type[mac_index] == NES_PHY_TYPE_CX4) && | ||
2493 | (nesadapter->hw_rev != NE020_REV)) { | ||
2494 | cdr_ctrl = nes_read_indexed(nesdev, | ||
2495 | NES_IDX_ETH_SERDES_CDR_CONTROL0 + | ||
2496 | mac_index * 0x200); | ||
2497 | nes_write_indexed(nesdev, | ||
2498 | NES_IDX_ETH_SERDES_CDR_CONTROL0 + | ||
2499 | mac_index * 0x200, | ||
2500 | cdr_ctrl | 0x000F0000); | ||
2501 | } | ||
2514 | nesadapter->mac_link_down[mac_index] = 0; | 2502 | nesadapter->mac_link_down[mac_index] = 0; |
2515 | list_for_each_entry(nesvnic, &nesadapter->nesvnic_list[mac_index], list) { | 2503 | list_for_each_entry(nesvnic, &nesadapter->nesvnic_list[mac_index], list) { |
2516 | nes_debug(NES_DBG_PHY, "The Link is UP!!. linkup was %d\n", | 2504 | nes_debug(NES_DBG_PHY, "The Link is UP!!. linkup was %d\n", |
@@ -2525,6 +2513,17 @@ static void nes_process_mac_intr(struct nes_device *nesdev, u32 mac_number) | |||
2525 | } | 2513 | } |
2526 | } | 2514 | } |
2527 | } else { | 2515 | } else { |
2516 | if (wide_ppm_offset && | ||
2517 | (nesadapter->phy_type[mac_index] == NES_PHY_TYPE_CX4) && | ||
2518 | (nesadapter->hw_rev != NE020_REV)) { | ||
2519 | cdr_ctrl = nes_read_indexed(nesdev, | ||
2520 | NES_IDX_ETH_SERDES_CDR_CONTROL0 + | ||
2521 | mac_index * 0x200); | ||
2522 | nes_write_indexed(nesdev, | ||
2523 | NES_IDX_ETH_SERDES_CDR_CONTROL0 + | ||
2524 | mac_index * 0x200, | ||
2525 | cdr_ctrl & 0xFFF0FFFF); | ||
2526 | } | ||
2528 | nesadapter->mac_link_down[mac_index] = 1; | 2527 | nesadapter->mac_link_down[mac_index] = 1; |
2529 | list_for_each_entry(nesvnic, &nesadapter->nesvnic_list[mac_index], list) { | 2528 | list_for_each_entry(nesvnic, &nesadapter->nesvnic_list[mac_index], list) { |
2530 | nes_debug(NES_DBG_PHY, "The Link is Down!!. linkup was %d\n", | 2529 | nes_debug(NES_DBG_PHY, "The Link is Down!!. linkup was %d\n", |
diff --git a/drivers/infiniband/hw/nes/nes_hw.h b/drivers/infiniband/hw/nes/nes_hw.h index f41a8710d2a8..c3654c6383fe 100644 --- a/drivers/infiniband/hw/nes/nes_hw.h +++ b/drivers/infiniband/hw/nes/nes_hw.h | |||
@@ -35,12 +35,14 @@ | |||
35 | 35 | ||
36 | #include <linux/inet_lro.h> | 36 | #include <linux/inet_lro.h> |
37 | 37 | ||
38 | #define NES_PHY_TYPE_CX4 1 | ||
38 | #define NES_PHY_TYPE_1G 2 | 39 | #define NES_PHY_TYPE_1G 2 |
39 | #define NES_PHY_TYPE_IRIS 3 | 40 | #define NES_PHY_TYPE_IRIS 3 |
40 | #define NES_PHY_TYPE_ARGUS 4 | 41 | #define NES_PHY_TYPE_ARGUS 4 |
41 | #define NES_PHY_TYPE_PUMA_1G 5 | 42 | #define NES_PHY_TYPE_PUMA_1G 5 |
42 | #define NES_PHY_TYPE_PUMA_10G 6 | 43 | #define NES_PHY_TYPE_PUMA_10G 6 |
43 | #define NES_PHY_TYPE_GLADIUS 7 | 44 | #define NES_PHY_TYPE_GLADIUS 7 |
45 | #define NES_PHY_TYPE_SFP_D 8 | ||
44 | 46 | ||
45 | #define NES_MULTICAST_PF_MAX 8 | 47 | #define NES_MULTICAST_PF_MAX 8 |
46 | 48 | ||
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c index ecb1f6fd6276..c6e6611d3016 100644 --- a/drivers/infiniband/hw/nes/nes_nic.c +++ b/drivers/infiniband/hw/nes/nes_nic.c | |||
@@ -1426,49 +1426,55 @@ static int nes_netdev_get_settings(struct net_device *netdev, struct ethtool_cmd | |||
1426 | struct nes_vnic *nesvnic = netdev_priv(netdev); | 1426 | struct nes_vnic *nesvnic = netdev_priv(netdev); |
1427 | struct nes_device *nesdev = nesvnic->nesdev; | 1427 | struct nes_device *nesdev = nesvnic->nesdev; |
1428 | struct nes_adapter *nesadapter = nesdev->nesadapter; | 1428 | struct nes_adapter *nesadapter = nesdev->nesadapter; |
1429 | u32 mac_index = nesdev->mac_index; | ||
1430 | u8 phy_type = nesadapter->phy_type[mac_index]; | ||
1431 | u8 phy_index = nesadapter->phy_index[mac_index]; | ||
1429 | u16 phy_data; | 1432 | u16 phy_data; |
1430 | 1433 | ||
1431 | et_cmd->duplex = DUPLEX_FULL; | 1434 | et_cmd->duplex = DUPLEX_FULL; |
1432 | et_cmd->port = PORT_MII; | 1435 | et_cmd->port = PORT_MII; |
1436 | et_cmd->maxtxpkt = 511; | ||
1437 | et_cmd->maxrxpkt = 511; | ||
1433 | 1438 | ||
1434 | if (nesadapter->OneG_Mode) { | 1439 | if (nesadapter->OneG_Mode) { |
1435 | et_cmd->speed = SPEED_1000; | 1440 | et_cmd->speed = SPEED_1000; |
1436 | if (nesadapter->phy_type[nesdev->mac_index] == NES_PHY_TYPE_PUMA_1G) { | 1441 | if (phy_type == NES_PHY_TYPE_PUMA_1G) { |
1437 | et_cmd->supported = SUPPORTED_1000baseT_Full; | 1442 | et_cmd->supported = SUPPORTED_1000baseT_Full; |
1438 | et_cmd->advertising = ADVERTISED_1000baseT_Full; | 1443 | et_cmd->advertising = ADVERTISED_1000baseT_Full; |
1439 | et_cmd->autoneg = AUTONEG_DISABLE; | 1444 | et_cmd->autoneg = AUTONEG_DISABLE; |
1440 | et_cmd->transceiver = XCVR_INTERNAL; | 1445 | et_cmd->transceiver = XCVR_INTERNAL; |
1441 | et_cmd->phy_address = nesdev->mac_index; | 1446 | et_cmd->phy_address = mac_index; |
1442 | } else { | 1447 | } else { |
1443 | et_cmd->supported = SUPPORTED_1000baseT_Full | SUPPORTED_Autoneg; | 1448 | et_cmd->supported = SUPPORTED_1000baseT_Full |
1444 | et_cmd->advertising = ADVERTISED_1000baseT_Full | ADVERTISED_Autoneg; | 1449 | | SUPPORTED_Autoneg; |
1445 | nes_read_1G_phy_reg(nesdev, 0, nesadapter->phy_index[nesdev->mac_index], &phy_data); | 1450 | et_cmd->advertising = ADVERTISED_1000baseT_Full |
1451 | | ADVERTISED_Autoneg; | ||
1452 | nes_read_1G_phy_reg(nesdev, 0, phy_index, &phy_data); | ||
1446 | if (phy_data & 0x1000) | 1453 | if (phy_data & 0x1000) |
1447 | et_cmd->autoneg = AUTONEG_ENABLE; | 1454 | et_cmd->autoneg = AUTONEG_ENABLE; |
1448 | else | 1455 | else |
1449 | et_cmd->autoneg = AUTONEG_DISABLE; | 1456 | et_cmd->autoneg = AUTONEG_DISABLE; |
1450 | et_cmd->transceiver = XCVR_EXTERNAL; | 1457 | et_cmd->transceiver = XCVR_EXTERNAL; |
1451 | et_cmd->phy_address = nesadapter->phy_index[nesdev->mac_index]; | 1458 | et_cmd->phy_address = phy_index; |
1452 | } | 1459 | } |
1460 | return 0; | ||
1461 | } | ||
1462 | if ((phy_type == NES_PHY_TYPE_IRIS) || | ||
1463 | (phy_type == NES_PHY_TYPE_ARGUS) || | ||
1464 | (phy_type == NES_PHY_TYPE_SFP_D)) { | ||
1465 | et_cmd->transceiver = XCVR_EXTERNAL; | ||
1466 | et_cmd->port = PORT_FIBRE; | ||
1467 | et_cmd->supported = SUPPORTED_FIBRE; | ||
1468 | et_cmd->advertising = ADVERTISED_FIBRE; | ||
1469 | et_cmd->phy_address = phy_index; | ||
1453 | } else { | 1470 | } else { |
1454 | if ((nesadapter->phy_type[nesdev->mac_index] == NES_PHY_TYPE_IRIS) || | 1471 | et_cmd->transceiver = XCVR_INTERNAL; |
1455 | (nesadapter->phy_type[nesdev->mac_index] == NES_PHY_TYPE_ARGUS)) { | 1472 | et_cmd->supported = SUPPORTED_10000baseT_Full; |
1456 | et_cmd->transceiver = XCVR_EXTERNAL; | 1473 | et_cmd->advertising = ADVERTISED_10000baseT_Full; |
1457 | et_cmd->port = PORT_FIBRE; | 1474 | et_cmd->phy_address = mac_index; |
1458 | et_cmd->supported = SUPPORTED_FIBRE; | ||
1459 | et_cmd->advertising = ADVERTISED_FIBRE; | ||
1460 | et_cmd->phy_address = nesadapter->phy_index[nesdev->mac_index]; | ||
1461 | } else { | ||
1462 | et_cmd->transceiver = XCVR_INTERNAL; | ||
1463 | et_cmd->supported = SUPPORTED_10000baseT_Full; | ||
1464 | et_cmd->advertising = ADVERTISED_10000baseT_Full; | ||
1465 | et_cmd->phy_address = nesdev->mac_index; | ||
1466 | } | ||
1467 | et_cmd->speed = SPEED_10000; | ||
1468 | et_cmd->autoneg = AUTONEG_DISABLE; | ||
1469 | } | 1475 | } |
1470 | et_cmd->maxtxpkt = 511; | 1476 | et_cmd->speed = SPEED_10000; |
1471 | et_cmd->maxrxpkt = 511; | 1477 | et_cmd->autoneg = AUTONEG_DISABLE; |
1472 | return 0; | 1478 | return 0; |
1473 | } | 1479 | } |
1474 | 1480 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c index 5a76a5510350..4c57f329dd50 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c | |||
@@ -70,12 +70,14 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey) | |||
70 | */ | 70 | */ |
71 | if (ppriv->pkey == pkey) { | 71 | if (ppriv->pkey == pkey) { |
72 | result = -ENOTUNIQ; | 72 | result = -ENOTUNIQ; |
73 | priv = NULL; | ||
73 | goto err; | 74 | goto err; |
74 | } | 75 | } |
75 | 76 | ||
76 | list_for_each_entry(priv, &ppriv->child_intfs, list) { | 77 | list_for_each_entry(priv, &ppriv->child_intfs, list) { |
77 | if (priv->pkey == pkey) { | 78 | if (priv->pkey == pkey) { |
78 | result = -ENOTUNIQ; | 79 | result = -ENOTUNIQ; |
80 | priv = NULL; | ||
79 | goto err; | 81 | goto err; |
80 | } | 82 | } |
81 | } | 83 | } |
@@ -96,7 +98,7 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey) | |||
96 | 98 | ||
97 | result = ipoib_set_dev_features(priv, ppriv->ca); | 99 | result = ipoib_set_dev_features(priv, ppriv->ca); |
98 | if (result) | 100 | if (result) |
99 | goto device_init_failed; | 101 | goto err; |
100 | 102 | ||
101 | priv->pkey = pkey; | 103 | priv->pkey = pkey; |
102 | 104 | ||
@@ -109,7 +111,7 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey) | |||
109 | ipoib_warn(ppriv, "failed to initialize subinterface: " | 111 | ipoib_warn(ppriv, "failed to initialize subinterface: " |
110 | "device %s, port %d", | 112 | "device %s, port %d", |
111 | ppriv->ca->name, ppriv->port); | 113 | ppriv->ca->name, ppriv->port); |
112 | goto device_init_failed; | 114 | goto err; |
113 | } | 115 | } |
114 | 116 | ||
115 | result = register_netdevice(priv->dev); | 117 | result = register_netdevice(priv->dev); |
@@ -146,19 +148,19 @@ sysfs_failed: | |||
146 | register_failed: | 148 | register_failed: |
147 | ipoib_dev_cleanup(priv->dev); | 149 | ipoib_dev_cleanup(priv->dev); |
148 | 150 | ||
149 | device_init_failed: | ||
150 | free_netdev(priv->dev); | ||
151 | |||
152 | err: | 151 | err: |
153 | mutex_unlock(&ppriv->vlan_mutex); | 152 | mutex_unlock(&ppriv->vlan_mutex); |
154 | rtnl_unlock(); | 153 | rtnl_unlock(); |
154 | if (priv) | ||
155 | free_netdev(priv->dev); | ||
156 | |||
155 | return result; | 157 | return result; |
156 | } | 158 | } |
157 | 159 | ||
158 | int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey) | 160 | int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey) |
159 | { | 161 | { |
160 | struct ipoib_dev_priv *ppriv, *priv, *tpriv; | 162 | struct ipoib_dev_priv *ppriv, *priv, *tpriv; |
161 | int ret = -ENOENT; | 163 | struct net_device *dev = NULL; |
162 | 164 | ||
163 | if (!capable(CAP_NET_ADMIN)) | 165 | if (!capable(CAP_NET_ADMIN)) |
164 | return -EPERM; | 166 | return -EPERM; |
@@ -172,14 +174,17 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey) | |||
172 | unregister_netdevice(priv->dev); | 174 | unregister_netdevice(priv->dev); |
173 | ipoib_dev_cleanup(priv->dev); | 175 | ipoib_dev_cleanup(priv->dev); |
174 | list_del(&priv->list); | 176 | list_del(&priv->list); |
175 | free_netdev(priv->dev); | 177 | dev = priv->dev; |
176 | |||
177 | ret = 0; | ||
178 | break; | 178 | break; |
179 | } | 179 | } |
180 | } | 180 | } |
181 | mutex_unlock(&ppriv->vlan_mutex); | 181 | mutex_unlock(&ppriv->vlan_mutex); |
182 | rtnl_unlock(); | 182 | rtnl_unlock(); |
183 | 183 | ||
184 | return ret; | 184 | if (dev) { |
185 | free_netdev(dev); | ||
186 | return 0; | ||
187 | } | ||
188 | |||
189 | return -ENODEV; | ||
185 | } | 190 | } |
diff --git a/drivers/net/mlx4/port.c b/drivers/net/mlx4/port.c index 7cce3342ef8c..606aa58afdea 100644 --- a/drivers/net/mlx4/port.c +++ b/drivers/net/mlx4/port.c | |||
@@ -299,13 +299,14 @@ int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port) | |||
299 | struct mlx4_cmd_mailbox *mailbox; | 299 | struct mlx4_cmd_mailbox *mailbox; |
300 | int err; | 300 | int err; |
301 | 301 | ||
302 | if (dev->caps.port_type[port] == MLX4_PORT_TYPE_ETH) | ||
303 | return 0; | ||
304 | |||
302 | mailbox = mlx4_alloc_cmd_mailbox(dev); | 305 | mailbox = mlx4_alloc_cmd_mailbox(dev); |
303 | if (IS_ERR(mailbox)) | 306 | if (IS_ERR(mailbox)) |
304 | return PTR_ERR(mailbox); | 307 | return PTR_ERR(mailbox); |
305 | 308 | ||
306 | memset(mailbox->buf, 0, 256); | 309 | memset(mailbox->buf, 0, 256); |
307 | if (dev->caps.port_type[port] == MLX4_PORT_TYPE_ETH) | ||
308 | return 0; | ||
309 | 310 | ||
310 | ((__be32 *) mailbox->buf)[1] = dev->caps.ib_port_def_cap[port]; | 311 | ((__be32 *) mailbox->buf)[1] = dev->caps.ib_port_def_cap[port]; |
311 | err = mlx4_cmd(dev, mailbox->dma, port, 0, MLX4_CMD_SET_PORT, | 312 | err = mlx4_cmd(dev, mailbox->dma, port, 0, MLX4_CMD_SET_PORT, |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index ac77d8b8251d..6132353dcf62 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -342,7 +342,7 @@ static int ext4_valid_extent_idx(struct inode *inode, | |||
342 | ext4_fsblk_t block = idx_pblock(ext_idx); | 342 | ext4_fsblk_t block = idx_pblock(ext_idx); |
343 | struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es; | 343 | struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es; |
344 | if (unlikely(block < le32_to_cpu(es->s_first_data_block) || | 344 | if (unlikely(block < le32_to_cpu(es->s_first_data_block) || |
345 | (block > ext4_blocks_count(es)))) | 345 | (block >= ext4_blocks_count(es)))) |
346 | return 0; | 346 | return 0; |
347 | else | 347 | else |
348 | return 1; | 348 | return 1; |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index a2e7952bc5f9..c6bd6ced3bb7 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -372,16 +372,16 @@ static int ext4_block_to_path(struct inode *inode, | |||
372 | } | 372 | } |
373 | 373 | ||
374 | static int __ext4_check_blockref(const char *function, struct inode *inode, | 374 | static int __ext4_check_blockref(const char *function, struct inode *inode, |
375 | unsigned int *p, unsigned int max) { | 375 | __le32 *p, unsigned int max) { |
376 | 376 | ||
377 | unsigned int maxblocks = ext4_blocks_count(EXT4_SB(inode->i_sb)->s_es); | 377 | unsigned int maxblocks = ext4_blocks_count(EXT4_SB(inode->i_sb)->s_es); |
378 | unsigned int *bref = p; | 378 | __le32 *bref = p; |
379 | while (bref < p+max) { | 379 | while (bref < p+max) { |
380 | if (unlikely(*bref >= maxblocks)) { | 380 | if (unlikely(le32_to_cpu(*bref) >= maxblocks)) { |
381 | ext4_error(inode->i_sb, function, | 381 | ext4_error(inode->i_sb, function, |
382 | "block reference %u >= max (%u) " | 382 | "block reference %u >= max (%u) " |
383 | "in inode #%lu, offset=%d", | 383 | "in inode #%lu, offset=%d", |
384 | *bref, maxblocks, | 384 | le32_to_cpu(*bref), maxblocks, |
385 | inode->i_ino, (int)(bref-p)); | 385 | inode->i_ino, (int)(bref-p)); |
386 | return -EIO; | 386 | return -EIO; |
387 | } | 387 | } |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 9987bba99db3..2958f4e6f222 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -2508,6 +2508,15 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
2508 | if (EXT4_BLOCKS_PER_GROUP(sb) == 0) | 2508 | if (EXT4_BLOCKS_PER_GROUP(sb) == 0) |
2509 | goto cantfind_ext4; | 2509 | goto cantfind_ext4; |
2510 | 2510 | ||
2511 | /* check blocks count against device size */ | ||
2512 | blocks_count = sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits; | ||
2513 | if (blocks_count && ext4_blocks_count(es) > blocks_count) { | ||
2514 | printk(KERN_WARNING "EXT4-fs: bad geometry: block count %llu " | ||
2515 | "exceeds size of device (%llu blocks)\n", | ||
2516 | ext4_blocks_count(es), blocks_count); | ||
2517 | goto failed_mount; | ||
2518 | } | ||
2519 | |||
2511 | /* | 2520 | /* |
2512 | * It makes no sense for the first data block to be beyond the end | 2521 | * It makes no sense for the first data block to be beyond the end |
2513 | * of the filesystem. | 2522 | * of the filesystem. |
diff --git a/include/linux/ide.h b/include/linux/ide.h index a5d26f66ef78..ff65fffb078f 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -240,65 +240,38 @@ typedef enum { | |||
240 | } ide_startstop_t; | 240 | } ide_startstop_t; |
241 | 241 | ||
242 | enum { | 242 | enum { |
243 | IDE_VALID_ERROR = (1 << 1), | ||
244 | IDE_VALID_FEATURE = IDE_VALID_ERROR, | ||
245 | IDE_VALID_NSECT = (1 << 2), | ||
246 | IDE_VALID_LBAL = (1 << 3), | ||
247 | IDE_VALID_LBAM = (1 << 4), | ||
248 | IDE_VALID_LBAH = (1 << 5), | ||
249 | IDE_VALID_DEVICE = (1 << 6), | ||
250 | IDE_VALID_LBA = IDE_VALID_LBAL | | ||
251 | IDE_VALID_LBAM | | ||
252 | IDE_VALID_LBAH, | ||
253 | IDE_VALID_OUT_TF = IDE_VALID_FEATURE | | ||
254 | IDE_VALID_NSECT | | ||
255 | IDE_VALID_LBA, | ||
256 | IDE_VALID_IN_TF = IDE_VALID_NSECT | | ||
257 | IDE_VALID_LBA, | ||
258 | IDE_VALID_OUT_HOB = IDE_VALID_OUT_TF, | ||
259 | IDE_VALID_IN_HOB = IDE_VALID_ERROR | | ||
260 | IDE_VALID_NSECT | | ||
261 | IDE_VALID_LBA, | ||
262 | }; | ||
263 | |||
264 | enum { | ||
243 | IDE_TFLAG_LBA48 = (1 << 0), | 265 | IDE_TFLAG_LBA48 = (1 << 0), |
244 | IDE_TFLAG_OUT_HOB_FEATURE = (1 << 1), | 266 | IDE_TFLAG_WRITE = (1 << 1), |
245 | IDE_TFLAG_OUT_HOB_NSECT = (1 << 2), | 267 | IDE_TFLAG_CUSTOM_HANDLER = (1 << 2), |
246 | IDE_TFLAG_OUT_HOB_LBAL = (1 << 3), | 268 | IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 3), |
247 | IDE_TFLAG_OUT_HOB_LBAM = (1 << 4), | ||
248 | IDE_TFLAG_OUT_HOB_LBAH = (1 << 5), | ||
249 | IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE | | ||
250 | IDE_TFLAG_OUT_HOB_NSECT | | ||
251 | IDE_TFLAG_OUT_HOB_LBAL | | ||
252 | IDE_TFLAG_OUT_HOB_LBAM | | ||
253 | IDE_TFLAG_OUT_HOB_LBAH, | ||
254 | IDE_TFLAG_OUT_FEATURE = (1 << 6), | ||
255 | IDE_TFLAG_OUT_NSECT = (1 << 7), | ||
256 | IDE_TFLAG_OUT_LBAL = (1 << 8), | ||
257 | IDE_TFLAG_OUT_LBAM = (1 << 9), | ||
258 | IDE_TFLAG_OUT_LBAH = (1 << 10), | ||
259 | IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE | | ||
260 | IDE_TFLAG_OUT_NSECT | | ||
261 | IDE_TFLAG_OUT_LBAL | | ||
262 | IDE_TFLAG_OUT_LBAM | | ||
263 | IDE_TFLAG_OUT_LBAH, | ||
264 | IDE_TFLAG_OUT_DEVICE = (1 << 11), | ||
265 | IDE_TFLAG_WRITE = (1 << 12), | ||
266 | IDE_TFLAG_CUSTOM_HANDLER = (1 << 13), | ||
267 | IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 14), | ||
268 | IDE_TFLAG_IN_HOB_ERROR = (1 << 15), | ||
269 | IDE_TFLAG_IN_HOB_NSECT = (1 << 16), | ||
270 | IDE_TFLAG_IN_HOB_LBAL = (1 << 17), | ||
271 | IDE_TFLAG_IN_HOB_LBAM = (1 << 18), | ||
272 | IDE_TFLAG_IN_HOB_LBAH = (1 << 19), | ||
273 | IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL | | ||
274 | IDE_TFLAG_IN_HOB_LBAM | | ||
275 | IDE_TFLAG_IN_HOB_LBAH, | ||
276 | IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_ERROR | | ||
277 | IDE_TFLAG_IN_HOB_NSECT | | ||
278 | IDE_TFLAG_IN_HOB_LBA, | ||
279 | IDE_TFLAG_IN_ERROR = (1 << 20), | ||
280 | IDE_TFLAG_IN_NSECT = (1 << 21), | ||
281 | IDE_TFLAG_IN_LBAL = (1 << 22), | ||
282 | IDE_TFLAG_IN_LBAM = (1 << 23), | ||
283 | IDE_TFLAG_IN_LBAH = (1 << 24), | ||
284 | IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL | | ||
285 | IDE_TFLAG_IN_LBAM | | ||
286 | IDE_TFLAG_IN_LBAH, | ||
287 | IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT | | ||
288 | IDE_TFLAG_IN_LBA, | ||
289 | IDE_TFLAG_IN_DEVICE = (1 << 25), | ||
290 | IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB | | ||
291 | IDE_TFLAG_IN_HOB, | ||
292 | IDE_TFLAG_TF = IDE_TFLAG_OUT_TF | | ||
293 | IDE_TFLAG_IN_TF, | ||
294 | IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE | | ||
295 | IDE_TFLAG_IN_DEVICE, | ||
296 | /* force 16-bit I/O operations */ | 269 | /* force 16-bit I/O operations */ |
297 | IDE_TFLAG_IO_16BIT = (1 << 26), | 270 | IDE_TFLAG_IO_16BIT = (1 << 4), |
298 | /* struct ide_cmd was allocated using kmalloc() */ | 271 | /* struct ide_cmd was allocated using kmalloc() */ |
299 | IDE_TFLAG_DYN = (1 << 27), | 272 | IDE_TFLAG_DYN = (1 << 5), |
300 | IDE_TFLAG_FS = (1 << 28), | 273 | IDE_TFLAG_FS = (1 << 6), |
301 | IDE_TFLAG_MULTI_PIO = (1 << 29), | 274 | IDE_TFLAG_MULTI_PIO = (1 << 7), |
302 | }; | 275 | }; |
303 | 276 | ||
304 | enum { | 277 | enum { |
@@ -309,45 +282,34 @@ enum { | |||
309 | }; | 282 | }; |
310 | 283 | ||
311 | struct ide_taskfile { | 284 | struct ide_taskfile { |
312 | u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */ | 285 | u8 data; /* 0: data byte (for TASKFILE ioctl) */ |
313 | /* 1-5: additional data to support LBA48 */ | 286 | union { /* 1: */ |
314 | union { | 287 | u8 error; /* read: error */ |
315 | u8 hob_error; /* read: error */ | 288 | u8 feature; /* write: feature */ |
316 | u8 hob_feature; /* write: feature */ | ||
317 | }; | ||
318 | |||
319 | u8 hob_nsect; | ||
320 | u8 hob_lbal; | ||
321 | u8 hob_lbam; | ||
322 | u8 hob_lbah; | ||
323 | |||
324 | u8 data; /* 6: low data byte (for TASKFILE IOCTL) */ | ||
325 | |||
326 | union { /* 7: */ | ||
327 | u8 error; /* read: error */ | ||
328 | u8 feature; /* write: feature */ | ||
329 | }; | 289 | }; |
330 | 290 | u8 nsect; /* 2: number of sectors */ | |
331 | u8 nsect; /* 8: number of sectors */ | 291 | u8 lbal; /* 3: LBA low */ |
332 | u8 lbal; /* 9: LBA low */ | 292 | u8 lbam; /* 4: LBA mid */ |
333 | u8 lbam; /* 10: LBA mid */ | 293 | u8 lbah; /* 5: LBA high */ |
334 | u8 lbah; /* 11: LBA high */ | 294 | u8 device; /* 6: device select */ |
335 | 295 | union { /* 7: */ | |
336 | u8 device; /* 12: device select */ | 296 | u8 status; /* read: status */ |
337 | |||
338 | union { /* 13: */ | ||
339 | u8 status; /* read: status */ | ||
340 | u8 command; /* write: command */ | 297 | u8 command; /* write: command */ |
341 | }; | 298 | }; |
342 | }; | 299 | }; |
343 | 300 | ||
344 | struct ide_cmd { | 301 | struct ide_cmd { |
345 | union { | 302 | struct ide_taskfile tf; |
346 | struct ide_taskfile tf; | 303 | struct ide_taskfile hob; |
347 | u8 tf_array[14]; | 304 | struct { |
348 | }; | 305 | struct { |
306 | u8 tf; | ||
307 | u8 hob; | ||
308 | } out, in; | ||
309 | } valid; | ||
310 | |||
311 | u8 tf_flags; | ||
349 | u8 ftf_flags; /* for TASKFILE ioctl */ | 312 | u8 ftf_flags; /* for TASKFILE ioctl */ |
350 | u32 tf_flags; | ||
351 | int protocol; | 313 | int protocol; |
352 | 314 | ||
353 | int sg_nents; /* number of sg entries */ | 315 | int sg_nents; /* number of sg entries */ |
@@ -662,8 +624,8 @@ struct ide_tp_ops { | |||
662 | void (*write_devctl)(struct hwif_s *, u8); | 624 | void (*write_devctl)(struct hwif_s *, u8); |
663 | 625 | ||
664 | void (*dev_select)(ide_drive_t *); | 626 | void (*dev_select)(ide_drive_t *); |
665 | void (*tf_load)(ide_drive_t *, struct ide_cmd *); | 627 | void (*tf_load)(ide_drive_t *, struct ide_taskfile *, u8); |
666 | void (*tf_read)(ide_drive_t *, struct ide_cmd *); | 628 | void (*tf_read)(ide_drive_t *, struct ide_taskfile *, u8); |
667 | 629 | ||
668 | void (*input_data)(ide_drive_t *, struct ide_cmd *, | 630 | void (*input_data)(ide_drive_t *, struct ide_cmd *, |
669 | void *, unsigned int); | 631 | void *, unsigned int); |
@@ -1162,7 +1124,8 @@ extern int ide_devset_execute(ide_drive_t *drive, | |||
1162 | void ide_complete_cmd(ide_drive_t *, struct ide_cmd *, u8, u8); | 1124 | void ide_complete_cmd(ide_drive_t *, struct ide_cmd *, u8, u8); |
1163 | int ide_complete_rq(ide_drive_t *, int, unsigned int); | 1125 | int ide_complete_rq(ide_drive_t *, int, unsigned int); |
1164 | 1126 | ||
1165 | void ide_tf_dump(const char *, struct ide_taskfile *); | 1127 | void ide_tf_readback(ide_drive_t *drive, struct ide_cmd *cmd); |
1128 | void ide_tf_dump(const char *, struct ide_cmd *); | ||
1166 | 1129 | ||
1167 | void ide_exec_command(ide_hwif_t *, u8); | 1130 | void ide_exec_command(ide_hwif_t *, u8); |
1168 | u8 ide_read_status(ide_hwif_t *); | 1131 | u8 ide_read_status(ide_hwif_t *); |
@@ -1170,8 +1133,8 @@ u8 ide_read_altstatus(ide_hwif_t *); | |||
1170 | void ide_write_devctl(ide_hwif_t *, u8); | 1133 | void ide_write_devctl(ide_hwif_t *, u8); |
1171 | 1134 | ||
1172 | void ide_dev_select(ide_drive_t *); | 1135 | void ide_dev_select(ide_drive_t *); |
1173 | void ide_tf_load(ide_drive_t *, struct ide_cmd *); | 1136 | void ide_tf_load(ide_drive_t *, struct ide_taskfile *, u8); |
1174 | void ide_tf_read(ide_drive_t *, struct ide_cmd *); | 1137 | void ide_tf_read(ide_drive_t *, struct ide_taskfile *, u8); |
1175 | 1138 | ||
1176 | void ide_input_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int); | 1139 | void ide_input_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int); |
1177 | void ide_output_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int); | 1140 | void ide_output_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int); |
@@ -1529,7 +1492,7 @@ static inline void ide_set_hwifdata (ide_hwif_t * hwif, void *data) | |||
1529 | 1492 | ||
1530 | extern void ide_toggle_bounce(ide_drive_t *drive, int on); | 1493 | extern void ide_toggle_bounce(ide_drive_t *drive, int on); |
1531 | 1494 | ||
1532 | u64 ide_get_lba_addr(struct ide_taskfile *, int); | 1495 | u64 ide_get_lba_addr(struct ide_cmd *, int); |
1533 | u8 ide_dump_status(ide_drive_t *, const char *, u8); | 1496 | u8 ide_dump_status(ide_drive_t *, const char *, u8); |
1534 | 1497 | ||
1535 | struct ide_timing { | 1498 | struct ide_timing { |