Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Bartlomiej Zolnierkiewicz | 59bca8c | 2008-02-01 23:09:33 +0100 | [diff] [blame] | 2 | * Copyright (C) 1994-1998 Linus Torvalds & authors (see below) |
| 3 | * Copyright (C) 1998-2002 Linux ATA Development |
| 4 | * Andre Hedrick <andre@linux-ide.org> |
Alan Cox | ccd32e2 | 2008-11-02 21:40:08 +0100 | [diff] [blame] | 5 | * Copyright (C) 2003 Red Hat |
Bartlomiej Zolnierkiewicz | 59bca8c | 2008-02-01 23:09:33 +0100 | [diff] [blame] | 6 | * Copyright (C) 2003-2005, 2007 Bartlomiej Zolnierkiewicz |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | /* |
| 10 | * Mostly written by Mark Lord <mlord@pobox.com> |
| 11 | * and Gadi Oxman <gadio@netvision.net.il> |
| 12 | * and Andre Hedrick <andre@linux-ide.org> |
| 13 | * |
| 14 | * This is the IDE/ATA disk driver, as evolved from hd.c and ide.c. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | #include <linux/types.h> |
| 18 | #include <linux/string.h> |
| 19 | #include <linux/kernel.h> |
| 20 | #include <linux/timer.h> |
| 21 | #include <linux/mm.h> |
| 22 | #include <linux/interrupt.h> |
| 23 | #include <linux/major.h> |
| 24 | #include <linux/errno.h> |
| 25 | #include <linux/genhd.h> |
| 26 | #include <linux/slab.h> |
| 27 | #include <linux/delay.h> |
Arjan van de Ven | cf8b897 | 2006-03-23 03:00:45 -0800 | [diff] [blame] | 28 | #include <linux/mutex.h> |
Richard Purdie | 2bfb646 | 2006-03-31 02:31:16 -0800 | [diff] [blame] | 29 | #include <linux/leds.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | #include <linux/ide.h> |
| 31 | |
| 32 | #include <asm/byteorder.h> |
| 33 | #include <asm/irq.h> |
| 34 | #include <asm/uaccess.h> |
| 35 | #include <asm/io.h> |
| 36 | #include <asm/div64.h> |
| 37 | |
Bartlomiej Zolnierkiewicz | f879048 | 2008-10-13 21:39:45 +0200 | [diff] [blame] | 38 | #include "ide-disk.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
Bartlomiej Zolnierkiewicz | ba76ae3 | 2008-01-25 22:17:16 +0100 | [diff] [blame] | 40 | static const u8 ide_rw_cmds[] = { |
Bartlomiej Zolnierkiewicz | aaaade3 | 2008-10-10 22:39:21 +0200 | [diff] [blame] | 41 | ATA_CMD_READ_MULTI, |
| 42 | ATA_CMD_WRITE_MULTI, |
| 43 | ATA_CMD_READ_MULTI_EXT, |
| 44 | ATA_CMD_WRITE_MULTI_EXT, |
| 45 | ATA_CMD_PIO_READ, |
| 46 | ATA_CMD_PIO_WRITE, |
| 47 | ATA_CMD_PIO_READ_EXT, |
| 48 | ATA_CMD_PIO_WRITE_EXT, |
| 49 | ATA_CMD_READ, |
| 50 | ATA_CMD_WRITE, |
| 51 | ATA_CMD_READ_EXT, |
| 52 | ATA_CMD_WRITE_EXT, |
Bartlomiej Zolnierkiewicz | ba76ae3 | 2008-01-25 22:17:16 +0100 | [diff] [blame] | 53 | }; |
| 54 | |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 55 | static void ide_tf_set_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 dma) |
Bartlomiej Zolnierkiewicz | ba76ae3 | 2008-01-25 22:17:16 +0100 | [diff] [blame] | 56 | { |
| 57 | u8 index, lba48, write; |
| 58 | |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 59 | lba48 = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 2 : 0; |
| 60 | write = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 1 : 0; |
Bartlomiej Zolnierkiewicz | ba76ae3 | 2008-01-25 22:17:16 +0100 | [diff] [blame] | 61 | |
Bartlomiej Zolnierkiewicz | 0dfb991 | 2009-03-27 12:46:39 +0100 | [diff] [blame^] | 62 | if (dma) { |
| 63 | cmd->protocol = ATA_PROT_DMA; |
Bartlomiej Zolnierkiewicz | ba4b2e6 | 2008-07-23 19:55:55 +0200 | [diff] [blame] | 64 | index = 8; |
Bartlomiej Zolnierkiewicz | 0dfb991 | 2009-03-27 12:46:39 +0100 | [diff] [blame^] | 65 | } else { |
| 66 | cmd->protocol = ATA_PROT_PIO; |
| 67 | if (drive->mult_count) { |
| 68 | cmd->tf_flags |= IDE_TFLAG_MULTI_PIO; |
| 69 | index = 0; |
| 70 | } else |
| 71 | index = 4; |
| 72 | } |
Bartlomiej Zolnierkiewicz | ba76ae3 | 2008-01-25 22:17:16 +0100 | [diff] [blame] | 73 | |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 74 | cmd->tf.command = ide_rw_cmds[index + lba48 + write]; |
Bartlomiej Zolnierkiewicz | ba76ae3 | 2008-01-25 22:17:16 +0100 | [diff] [blame] | 75 | } |
| 76 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | /* |
| 78 | * __ide_do_rw_disk() issues READ and WRITE commands to a disk, |
| 79 | * using LBA if supported, or CHS otherwise, to address sectors. |
| 80 | */ |
Bartlomiej Zolnierkiewicz | 9841654 | 2008-04-26 17:36:37 +0200 | [diff] [blame] | 81 | static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, |
| 82 | sector_t block) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | { |
Bartlomiej Zolnierkiewicz | 898ec22 | 2009-01-06 17:20:52 +0100 | [diff] [blame] | 84 | ide_hwif_t *hwif = drive->hwif; |
Bartlomiej Zolnierkiewicz | 790d123 | 2008-01-25 22:17:12 +0100 | [diff] [blame] | 85 | u16 nsectors = (u16)rq->nr_sectors; |
Bartlomiej Zolnierkiewicz | 97100fc | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 86 | u8 lba48 = !!(drive->dev_flags & IDE_DFLAG_LBA48); |
| 87 | u8 dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA); |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 88 | struct ide_cmd cmd; |
| 89 | struct ide_taskfile *tf = &cmd.tf; |
Bartlomiej Zolnierkiewicz | f6e29e3 | 2008-01-25 22:17:16 +0100 | [diff] [blame] | 90 | ide_startstop_t rc; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | |
Bartlomiej Zolnierkiewicz | 238e4f1 | 2007-10-19 00:30:07 +0200 | [diff] [blame] | 92 | if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && lba48 && dma) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | if (block + rq->nr_sectors > 1ULL << 28) |
| 94 | dma = 0; |
| 95 | else |
| 96 | lba48 = 0; |
| 97 | } |
| 98 | |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 99 | memset(&cmd, 0, sizeof(cmd)); |
| 100 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
Bartlomiej Zolnierkiewicz | 2bd06b2 | 2008-01-25 22:17:06 +0100 | [diff] [blame] | 101 | |
Bartlomiej Zolnierkiewicz | b6308ee | 2009-03-27 12:46:38 +0100 | [diff] [blame] | 102 | if (dma == 0) { |
| 103 | ide_init_sg_cmd(&cmd, nsectors); |
| 104 | ide_map_sg(drive, rq); |
| 105 | } |
| 106 | |
Bartlomiej Zolnierkiewicz | d1d7671 | 2008-10-13 21:39:38 +0200 | [diff] [blame] | 107 | if (drive->dev_flags & IDE_DFLAG_LBA) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | if (lba48) { |
Michael Richardson | c2f8311 | 2006-02-07 12:58:33 -0800 | [diff] [blame] | 109 | pr_debug("%s: LBA=0x%012llx\n", drive->name, |
| 110 | (unsigned long long)block); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | |
Bartlomiej Zolnierkiewicz | 790d123 | 2008-01-25 22:17:12 +0100 | [diff] [blame] | 112 | tf->hob_nsect = (nsectors >> 8) & 0xff; |
Bartlomiej Zolnierkiewicz | 2bd06b2 | 2008-01-25 22:17:06 +0100 | [diff] [blame] | 113 | tf->hob_lbal = (u8)(block >> 24); |
| 114 | if (sizeof(block) != 4) { |
| 115 | tf->hob_lbam = (u8)((u64)block >> 32); |
| 116 | tf->hob_lbah = (u8)((u64)block >> 40); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | } |
Bartlomiej Zolnierkiewicz | 2bd06b2 | 2008-01-25 22:17:06 +0100 | [diff] [blame] | 118 | |
Bartlomiej Zolnierkiewicz | 790d123 | 2008-01-25 22:17:12 +0100 | [diff] [blame] | 119 | tf->nsect = nsectors & 0xff; |
Bartlomiej Zolnierkiewicz | 2bd06b2 | 2008-01-25 22:17:06 +0100 | [diff] [blame] | 120 | tf->lbal = (u8) block; |
| 121 | tf->lbam = (u8)(block >> 8); |
| 122 | tf->lbah = (u8)(block >> 16); |
Bartlomiej Zolnierkiewicz | 6dd9b83 | 2008-01-26 20:13:03 +0100 | [diff] [blame] | 123 | |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 124 | cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | } else { |
Bartlomiej Zolnierkiewicz | 790d123 | 2008-01-25 22:17:12 +0100 | [diff] [blame] | 126 | tf->nsect = nsectors & 0xff; |
Bartlomiej Zolnierkiewicz | 2bd06b2 | 2008-01-25 22:17:06 +0100 | [diff] [blame] | 127 | tf->lbal = block; |
| 128 | tf->lbam = block >>= 8; |
| 129 | tf->lbah = block >>= 8; |
| 130 | tf->device = (block >> 8) & 0xf; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | } |
Bartlomiej Zolnierkiewicz | d1d7671 | 2008-10-13 21:39:38 +0200 | [diff] [blame] | 132 | |
| 133 | tf->device |= ATA_LBA; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | } else { |
Bartlomiej Zolnierkiewicz | 9841654 | 2008-04-26 17:36:37 +0200 | [diff] [blame] | 135 | unsigned int sect, head, cyl, track; |
| 136 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 137 | track = (int)block / drive->sect; |
| 138 | sect = (int)block % drive->sect + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 139 | head = track % drive->head; |
| 140 | cyl = track / drive->head; |
| 141 | |
| 142 | pr_debug("%s: CHS=%u/%u/%u\n", drive->name, cyl, head, sect); |
| 143 | |
Bartlomiej Zolnierkiewicz | 790d123 | 2008-01-25 22:17:12 +0100 | [diff] [blame] | 144 | tf->nsect = nsectors & 0xff; |
Bartlomiej Zolnierkiewicz | 2bd06b2 | 2008-01-25 22:17:06 +0100 | [diff] [blame] | 145 | tf->lbal = sect; |
| 146 | tf->lbam = cyl; |
| 147 | tf->lbah = cyl >> 8; |
| 148 | tf->device = head; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 | } |
| 150 | |
Bartlomiej Zolnierkiewicz | adb1af9 | 2009-03-27 12:46:38 +0100 | [diff] [blame] | 151 | cmd.tf_flags |= IDE_TFLAG_FS; |
| 152 | |
Bartlomiej Zolnierkiewicz | ba76ae3 | 2008-01-25 22:17:16 +0100 | [diff] [blame] | 153 | if (rq_data_dir(rq)) |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 154 | cmd.tf_flags |= IDE_TFLAG_WRITE; |
Bartlomiej Zolnierkiewicz | ba76ae3 | 2008-01-25 22:17:16 +0100 | [diff] [blame] | 155 | |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 156 | ide_tf_set_cmd(drive, &cmd, dma); |
| 157 | cmd.rq = rq; |
Bartlomiej Zolnierkiewicz | ba76ae3 | 2008-01-25 22:17:16 +0100 | [diff] [blame] | 158 | |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 159 | rc = do_rw_taskfile(drive, &cmd); |
Bartlomiej Zolnierkiewicz | 2bd06b2 | 2008-01-25 22:17:06 +0100 | [diff] [blame] | 160 | |
Bartlomiej Zolnierkiewicz | f6e29e3 | 2008-01-25 22:17:16 +0100 | [diff] [blame] | 161 | if (rc == ide_stopped && dma) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 162 | /* fallback to PIO */ |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 163 | cmd.tf_flags |= IDE_TFLAG_DMA_PIO_FALLBACK; |
| 164 | ide_tf_set_cmd(drive, &cmd, 0); |
Bartlomiej Zolnierkiewicz | b6308ee | 2009-03-27 12:46:38 +0100 | [diff] [blame] | 165 | ide_init_sg_cmd(&cmd, nsectors); |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 166 | rc = do_rw_taskfile(drive, &cmd); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 167 | } |
| 168 | |
Bartlomiej Zolnierkiewicz | f6e29e3 | 2008-01-25 22:17:16 +0100 | [diff] [blame] | 169 | return rc; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | } |
| 171 | |
| 172 | /* |
| 173 | * 268435455 == 137439 MB or 28bit limit |
| 174 | * 320173056 == 163929 MB or 48bit addressing |
| 175 | * 1073741822 == 549756 MB or 48bit addressing fake drive |
| 176 | */ |
| 177 | |
Bartlomiej Zolnierkiewicz | 806f80a | 2008-10-17 18:09:14 +0200 | [diff] [blame] | 178 | static ide_startstop_t ide_do_rw_disk(ide_drive_t *drive, struct request *rq, |
| 179 | sector_t block) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 180 | { |
Bartlomiej Zolnierkiewicz | 898ec22 | 2009-01-06 17:20:52 +0100 | [diff] [blame] | 181 | ide_hwif_t *hwif = drive->hwif; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 182 | |
Bartlomiej Zolnierkiewicz | 97100fc | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 183 | BUG_ON(drive->dev_flags & IDE_DFLAG_BLOCKED); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 184 | |
| 185 | if (!blk_fs_request(rq)) { |
| 186 | blk_dump_rq_flags(rq, "ide_do_rw_disk - bad command"); |
| 187 | ide_end_request(drive, 0, 0); |
| 188 | return ide_stopped; |
| 189 | } |
| 190 | |
Richard Purdie | 2bfb646 | 2006-03-31 02:31:16 -0800 | [diff] [blame] | 191 | ledtrig_ide_activity(); |
| 192 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 193 | pr_debug("%s: %sing: block=%llu, sectors=%lu, buffer=0x%08lx\n", |
| 194 | drive->name, rq_data_dir(rq) == READ ? "read" : "writ", |
Michael Richardson | c2f8311 | 2006-02-07 12:58:33 -0800 | [diff] [blame] | 195 | (unsigned long long)block, rq->nr_sectors, |
| 196 | (unsigned long)rq->buffer); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | |
| 198 | if (hwif->rw_disk) |
| 199 | hwif->rw_disk(drive, rq); |
| 200 | |
| 201 | return __ide_do_rw_disk(drive, rq, block); |
| 202 | } |
| 203 | |
| 204 | /* |
| 205 | * Queries for true maximum capacity of the drive. |
| 206 | * Returns maximum LBA address (> 0) of the drive, 0 if failed. |
| 207 | */ |
Bartlomiej Zolnierkiewicz | 7a3b751 | 2008-01-25 22:17:06 +0100 | [diff] [blame] | 208 | static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 209 | { |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 210 | struct ide_cmd cmd; |
| 211 | struct ide_taskfile *tf = &cmd.tf; |
Bartlomiej Zolnierkiewicz | 7a3b751 | 2008-01-25 22:17:06 +0100 | [diff] [blame] | 212 | u64 addr = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 214 | memset(&cmd, 0, sizeof(cmd)); |
Bartlomiej Zolnierkiewicz | 7a3b751 | 2008-01-25 22:17:06 +0100 | [diff] [blame] | 215 | if (lba48) |
Bartlomiej Zolnierkiewicz | aaaade3 | 2008-10-10 22:39:21 +0200 | [diff] [blame] | 216 | tf->command = ATA_CMD_READ_NATIVE_MAX_EXT; |
Bartlomiej Zolnierkiewicz | 7a3b751 | 2008-01-25 22:17:06 +0100 | [diff] [blame] | 217 | else |
Bartlomiej Zolnierkiewicz | aaaade3 | 2008-10-10 22:39:21 +0200 | [diff] [blame] | 218 | tf->command = ATA_CMD_READ_NATIVE_MAX; |
Bartlomiej Zolnierkiewicz | 650d841 | 2008-01-25 22:17:06 +0100 | [diff] [blame] | 219 | tf->device = ATA_LBA; |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 220 | |
| 221 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
Bartlomiej Zolnierkiewicz | a3bbb9d | 2008-01-25 22:17:10 +0100 | [diff] [blame] | 222 | if (lba48) |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 223 | cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); |
| 224 | |
| 225 | ide_no_data_taskfile(drive, &cmd); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 226 | |
| 227 | /* if OK, compute maximum address value */ |
Bartlomiej Zolnierkiewicz | a501633 | 2008-01-25 22:17:17 +0100 | [diff] [blame] | 228 | if ((tf->status & 0x01) == 0) |
| 229 | addr = ide_get_lba_addr(tf, lba48) + 1; |
Bartlomiej Zolnierkiewicz | 650d841 | 2008-01-25 22:17:06 +0100 | [diff] [blame] | 230 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | return addr; |
| 232 | } |
| 233 | |
| 234 | /* |
| 235 | * Sets maximum virtual LBA address of the drive. |
| 236 | * Returns new maximum virtual LBA address (> 0) or 0 on failure. |
| 237 | */ |
Bartlomiej Zolnierkiewicz | 7a3b751 | 2008-01-25 22:17:06 +0100 | [diff] [blame] | 238 | static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | { |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 240 | struct ide_cmd cmd; |
| 241 | struct ide_taskfile *tf = &cmd.tf; |
Bartlomiej Zolnierkiewicz | 7a3b751 | 2008-01-25 22:17:06 +0100 | [diff] [blame] | 242 | u64 addr_set = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | |
| 244 | addr_req--; |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 245 | |
| 246 | memset(&cmd, 0, sizeof(cmd)); |
Bartlomiej Zolnierkiewicz | 650d841 | 2008-01-25 22:17:06 +0100 | [diff] [blame] | 247 | tf->lbal = (addr_req >> 0) & 0xff; |
| 248 | tf->lbam = (addr_req >>= 8) & 0xff; |
| 249 | tf->lbah = (addr_req >>= 8) & 0xff; |
Bartlomiej Zolnierkiewicz | 7a3b751 | 2008-01-25 22:17:06 +0100 | [diff] [blame] | 250 | if (lba48) { |
| 251 | tf->hob_lbal = (addr_req >>= 8) & 0xff; |
| 252 | tf->hob_lbam = (addr_req >>= 8) & 0xff; |
| 253 | tf->hob_lbah = (addr_req >>= 8) & 0xff; |
Bartlomiej Zolnierkiewicz | aaaade3 | 2008-10-10 22:39:21 +0200 | [diff] [blame] | 254 | tf->command = ATA_CMD_SET_MAX_EXT; |
Bartlomiej Zolnierkiewicz | 7a3b751 | 2008-01-25 22:17:06 +0100 | [diff] [blame] | 255 | } else { |
| 256 | tf->device = (addr_req >>= 8) & 0x0f; |
Bartlomiej Zolnierkiewicz | aaaade3 | 2008-10-10 22:39:21 +0200 | [diff] [blame] | 257 | tf->command = ATA_CMD_SET_MAX; |
Bartlomiej Zolnierkiewicz | 7a3b751 | 2008-01-25 22:17:06 +0100 | [diff] [blame] | 258 | } |
| 259 | tf->device |= ATA_LBA; |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 260 | |
| 261 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
Bartlomiej Zolnierkiewicz | a3bbb9d | 2008-01-25 22:17:10 +0100 | [diff] [blame] | 262 | if (lba48) |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 263 | cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); |
| 264 | |
| 265 | ide_no_data_taskfile(drive, &cmd); |
| 266 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | /* if OK, compute maximum address value */ |
Bartlomiej Zolnierkiewicz | a501633 | 2008-01-25 22:17:17 +0100 | [diff] [blame] | 268 | if ((tf->status & 0x01) == 0) |
| 269 | addr_set = ide_get_lba_addr(tf, lba48) + 1; |
Bartlomiej Zolnierkiewicz | 650d841 | 2008-01-25 22:17:06 +0100 | [diff] [blame] | 270 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | return addr_set; |
| 272 | } |
| 273 | |
| 274 | static unsigned long long sectors_to_MB(unsigned long long n) |
| 275 | { |
| 276 | n <<= 9; /* make it bytes */ |
| 277 | do_div(n, 1000000); /* make it MB */ |
| 278 | return n; |
| 279 | } |
| 280 | |
| 281 | /* |
Bartlomiej Zolnierkiewicz | b0244a0 | 2007-08-20 22:42:57 +0200 | [diff] [blame] | 282 | * Some disks report total number of sectors instead of |
| 283 | * maximum sector address. We list them here. |
| 284 | */ |
| 285 | static const struct drive_list_entry hpa_list[] = { |
| 286 | { "ST340823A", NULL }, |
Jorge Juan Chico | 7062cdc | 2007-09-17 12:35:30 +0200 | [diff] [blame] | 287 | { "ST320413A", NULL }, |
Mikko Rapeli | b152fcd | 2008-02-19 01:41:25 +0100 | [diff] [blame] | 288 | { "ST310211A", NULL }, |
Bartlomiej Zolnierkiewicz | b0244a0 | 2007-08-20 22:42:57 +0200 | [diff] [blame] | 289 | { NULL, NULL } |
| 290 | }; |
| 291 | |
Arjan van de Ven | 858119e | 2006-01-14 13:20:43 -0800 | [diff] [blame] | 292 | static void idedisk_check_hpa(ide_drive_t *drive) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | { |
| 294 | unsigned long long capacity, set_max; |
Bartlomiej Zolnierkiewicz | 942dcd8 | 2008-10-10 22:39:30 +0200 | [diff] [blame] | 295 | int lba48 = ata_id_lba48_enabled(drive->id); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | |
| 297 | capacity = drive->capacity64; |
Bartlomiej Zolnierkiewicz | 7a3b751 | 2008-01-25 22:17:06 +0100 | [diff] [blame] | 298 | |
| 299 | set_max = idedisk_read_native_max_address(drive, lba48); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 300 | |
Bartlomiej Zolnierkiewicz | b0244a0 | 2007-08-20 22:42:57 +0200 | [diff] [blame] | 301 | if (ide_in_drive_list(drive->id, hpa_list)) { |
| 302 | /* |
| 303 | * Since we are inclusive wrt to firmware revisions do this |
| 304 | * extra check and apply the workaround only when needed. |
| 305 | */ |
| 306 | if (set_max == capacity + 1) |
| 307 | set_max--; |
| 308 | } |
| 309 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | if (set_max <= capacity) |
| 311 | return; |
| 312 | |
| 313 | printk(KERN_INFO "%s: Host Protected Area detected.\n" |
| 314 | "\tcurrent capacity is %llu sectors (%llu MB)\n" |
| 315 | "\tnative capacity is %llu sectors (%llu MB)\n", |
| 316 | drive->name, |
| 317 | capacity, sectors_to_MB(capacity), |
| 318 | set_max, sectors_to_MB(set_max)); |
| 319 | |
Bartlomiej Zolnierkiewicz | 7a3b751 | 2008-01-25 22:17:06 +0100 | [diff] [blame] | 320 | set_max = idedisk_set_max_address(drive, set_max, lba48); |
| 321 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | if (set_max) { |
| 323 | drive->capacity64 = set_max; |
| 324 | printk(KERN_INFO "%s: Host Protected Area disabled.\n", |
| 325 | drive->name); |
| 326 | } |
| 327 | } |
| 328 | |
Bartlomiej Zolnierkiewicz | 806f80a | 2008-10-17 18:09:14 +0200 | [diff] [blame] | 329 | static int ide_disk_get_capacity(ide_drive_t *drive) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | { |
Bartlomiej Zolnierkiewicz | 4dde449 | 2008-10-10 22:39:19 +0200 | [diff] [blame] | 331 | u16 *id = drive->id; |
Bartlomiej Zolnierkiewicz | d1d7671 | 2008-10-13 21:39:38 +0200 | [diff] [blame] | 332 | int lba; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 333 | |
Bartlomiej Zolnierkiewicz | 942dcd8 | 2008-10-10 22:39:30 +0200 | [diff] [blame] | 334 | if (ata_id_lba48_enabled(id)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | /* drive speaks 48-bit LBA */ |
Bartlomiej Zolnierkiewicz | d1d7671 | 2008-10-13 21:39:38 +0200 | [diff] [blame] | 336 | lba = 1; |
Bartlomiej Zolnierkiewicz | 48fb268 | 2008-10-10 22:39:19 +0200 | [diff] [blame] | 337 | drive->capacity64 = ata_id_u64(id, ATA_ID_LBA_CAPACITY_2); |
Bartlomiej Zolnierkiewicz | a02227c | 2008-10-10 22:39:31 +0200 | [diff] [blame] | 338 | } else if (ata_id_has_lba(id) && ata_id_is_lba_capacity_ok(id)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | /* drive speaks 28-bit LBA */ |
Bartlomiej Zolnierkiewicz | d1d7671 | 2008-10-13 21:39:38 +0200 | [diff] [blame] | 340 | lba = 1; |
Bartlomiej Zolnierkiewicz | 48fb268 | 2008-10-10 22:39:19 +0200 | [diff] [blame] | 341 | drive->capacity64 = ata_id_u32(id, ATA_ID_LBA_CAPACITY); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 342 | } else { |
| 343 | /* drive speaks boring old 28-bit CHS */ |
Bartlomiej Zolnierkiewicz | d1d7671 | 2008-10-13 21:39:38 +0200 | [diff] [blame] | 344 | lba = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | drive->capacity64 = drive->cyl * drive->head * drive->sect; |
| 346 | } |
Bartlomiej Zolnierkiewicz | d1d7671 | 2008-10-13 21:39:38 +0200 | [diff] [blame] | 347 | |
| 348 | if (lba) { |
| 349 | drive->dev_flags |= IDE_DFLAG_LBA; |
| 350 | |
| 351 | /* |
| 352 | * If this device supports the Host Protected Area feature set, |
| 353 | * then we may need to change our opinion about its capacity. |
| 354 | */ |
| 355 | if (ata_id_hpa_enabled(id)) |
| 356 | idedisk_check_hpa(drive); |
| 357 | } |
Bartlomiej Zolnierkiewicz | 0a70c7f | 2008-10-17 18:09:09 +0200 | [diff] [blame] | 358 | |
| 359 | /* limit drive capacity to 137GB if LBA48 cannot be used */ |
| 360 | if ((drive->dev_flags & IDE_DFLAG_LBA48) == 0 && |
| 361 | drive->capacity64 > 1ULL << 28) { |
| 362 | printk(KERN_WARNING "%s: cannot use LBA48 - full capacity " |
| 363 | "%llu sectors (%llu MB)\n", |
| 364 | drive->name, (unsigned long long)drive->capacity64, |
| 365 | sectors_to_MB(drive->capacity64)); |
| 366 | drive->capacity64 = 1ULL << 28; |
| 367 | } |
| 368 | |
| 369 | if ((drive->hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && |
| 370 | (drive->dev_flags & IDE_DFLAG_LBA48)) { |
| 371 | if (drive->capacity64 > 1ULL << 28) { |
| 372 | printk(KERN_INFO "%s: cannot use LBA48 DMA - PIO mode" |
| 373 | " will be used for accessing sectors " |
| 374 | "> %u\n", drive->name, 1 << 28); |
| 375 | } else |
| 376 | drive->dev_flags &= ~IDE_DFLAG_LBA48; |
| 377 | } |
Bartlomiej Zolnierkiewicz | 806f80a | 2008-10-17 18:09:14 +0200 | [diff] [blame] | 378 | |
| 379 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 380 | } |
| 381 | |
Jens Axboe | 165125e | 2007-07-24 09:28:11 +0200 | [diff] [blame] | 382 | static void idedisk_prepare_flush(struct request_queue *q, struct request *rq) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 | { |
| 384 | ide_drive_t *drive = q->queuedata; |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 385 | struct ide_cmd *cmd = kmalloc(sizeof(*cmd), GFP_ATOMIC); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 386 | |
Bartlomiej Zolnierkiewicz | 395d8ef | 2008-02-11 00:32:14 +0100 | [diff] [blame] | 387 | /* FIXME: map struct ide_taskfile on rq->cmd[] */ |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 388 | BUG_ON(cmd == NULL); |
Bartlomiej Zolnierkiewicz | 395d8ef | 2008-02-11 00:32:14 +0100 | [diff] [blame] | 389 | |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 390 | memset(cmd, 0, sizeof(*cmd)); |
Bartlomiej Zolnierkiewicz | ff2779b | 2008-10-10 22:39:31 +0200 | [diff] [blame] | 391 | if (ata_id_flush_ext_enabled(drive->id) && |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 392 | (drive->capacity64 >= (1UL << 28))) |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 393 | cmd->tf.command = ATA_CMD_FLUSH_EXT; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 394 | else |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 395 | cmd->tf.command = ATA_CMD_FLUSH; |
Bartlomiej Zolnierkiewicz | 0dfb991 | 2009-03-27 12:46:39 +0100 | [diff] [blame^] | 396 | cmd->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE | |
| 397 | IDE_TFLAG_DYN; |
| 398 | cmd->protocol = ATA_PROT_NODATA; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 399 | |
Bartlomiej Zolnierkiewicz | 813a0eb | 2008-01-25 22:17:10 +0100 | [diff] [blame] | 400 | rq->cmd_type = REQ_TYPE_ATA_TASKFILE; |
Jens Axboe | 4aff5e2 | 2006-08-10 08:44:47 +0200 | [diff] [blame] | 401 | rq->cmd_flags |= REQ_SOFTBARRIER; |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 402 | rq->special = cmd; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 403 | } |
| 404 | |
Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 405 | ide_devset_get(multcount, mult_count); |
| 406 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 407 | /* |
| 408 | * This is tightly woven into the driver->do_special can not touch. |
| 409 | * DON'T do it again until a total personality rewrite is committed. |
| 410 | */ |
| 411 | static int set_multcount(ide_drive_t *drive, int arg) |
| 412 | { |
FUJITA Tomonori | dd47087 | 2008-07-15 21:21:43 +0200 | [diff] [blame] | 413 | struct request *rq; |
| 414 | int error; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 415 | |
Bartlomiej Zolnierkiewicz | 48fb268 | 2008-10-10 22:39:19 +0200 | [diff] [blame] | 416 | if (arg < 0 || arg > (drive->id[ATA_ID_MAX_MULTSECT] & 0xff)) |
Bartlomiej Zolnierkiewicz | 1497943 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 417 | return -EINVAL; |
| 418 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 419 | if (drive->special.b.set_multmode) |
| 420 | return -EBUSY; |
Bartlomiej Zolnierkiewicz | 852738f | 2008-01-26 20:13:12 +0100 | [diff] [blame] | 421 | |
FUJITA Tomonori | dd47087 | 2008-07-15 21:21:43 +0200 | [diff] [blame] | 422 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); |
| 423 | rq->cmd_type = REQ_TYPE_ATA_TASKFILE; |
Bartlomiej Zolnierkiewicz | 852738f | 2008-01-26 20:13:12 +0100 | [diff] [blame] | 424 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 425 | drive->mult_req = arg; |
| 426 | drive->special.b.set_multmode = 1; |
FUJITA Tomonori | dd47087 | 2008-07-15 21:21:43 +0200 | [diff] [blame] | 427 | error = blk_execute_rq(drive->queue, NULL, rq, 0); |
| 428 | blk_put_request(rq); |
Bartlomiej Zolnierkiewicz | 9841654 | 2008-04-26 17:36:37 +0200 | [diff] [blame] | 429 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 430 | return (drive->mult_count == arg) ? 0 : -EIO; |
| 431 | } |
| 432 | |
Bartlomiej Zolnierkiewicz | 97100fc | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 433 | ide_devset_get_flag(nowerr, IDE_DFLAG_NOWERR); |
Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 434 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 435 | static int set_nowerr(ide_drive_t *drive, int arg) |
| 436 | { |
Bartlomiej Zolnierkiewicz | 1497943 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 437 | if (arg < 0 || arg > 1) |
| 438 | return -EINVAL; |
| 439 | |
Bartlomiej Zolnierkiewicz | 97100fc | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 440 | if (arg) |
| 441 | drive->dev_flags |= IDE_DFLAG_NOWERR; |
| 442 | else |
| 443 | drive->dev_flags &= ~IDE_DFLAG_NOWERR; |
| 444 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 445 | drive->bad_wstat = arg ? BAD_R_STAT : BAD_W_STAT; |
Bartlomiej Zolnierkiewicz | 97100fc | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 446 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 447 | return 0; |
| 448 | } |
| 449 | |
Bartlomiej Zolnierkiewicz | be3c096 | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 450 | static int ide_do_setfeature(ide_drive_t *drive, u8 feature, u8 nsect) |
| 451 | { |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 452 | struct ide_cmd cmd; |
Bartlomiej Zolnierkiewicz | be3c096 | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 453 | |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 454 | memset(&cmd, 0, sizeof(cmd)); |
| 455 | cmd.tf.feature = feature; |
| 456 | cmd.tf.nsect = nsect; |
| 457 | cmd.tf.command = ATA_CMD_SET_FEATURES; |
| 458 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
Bartlomiej Zolnierkiewicz | be3c096 | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 459 | |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 460 | return ide_no_data_taskfile(drive, &cmd); |
Bartlomiej Zolnierkiewicz | be3c096 | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 461 | } |
| 462 | |
Tejun Heo | 3e087b5 | 2006-01-06 09:57:31 +0100 | [diff] [blame] | 463 | static void update_ordered(ide_drive_t *drive) |
| 464 | { |
Bartlomiej Zolnierkiewicz | 4dde449 | 2008-10-10 22:39:19 +0200 | [diff] [blame] | 465 | u16 *id = drive->id; |
Tejun Heo | 3e087b5 | 2006-01-06 09:57:31 +0100 | [diff] [blame] | 466 | unsigned ordered = QUEUE_ORDERED_NONE; |
| 467 | prepare_flush_fn *prep_fn = NULL; |
Tejun Heo | 3e087b5 | 2006-01-06 09:57:31 +0100 | [diff] [blame] | 468 | |
Bartlomiej Zolnierkiewicz | 97100fc | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 469 | if (drive->dev_flags & IDE_DFLAG_WCACHE) { |
Tejun Heo | 3e087b5 | 2006-01-06 09:57:31 +0100 | [diff] [blame] | 470 | unsigned long long capacity; |
| 471 | int barrier; |
| 472 | /* |
| 473 | * We must avoid issuing commands a drive does not |
| 474 | * understand or we may crash it. We check flush cache |
| 475 | * is supported. We also check we have the LBA48 flush |
| 476 | * cache if the drive capacity is too large. By this |
| 477 | * time we have trimmed the drive capacity if LBA48 is |
| 478 | * not available so we don't need to recheck that. |
| 479 | */ |
Bartlomiej Zolnierkiewicz | 5fef0e5 | 2008-10-17 18:09:12 +0200 | [diff] [blame] | 480 | capacity = ide_gd_capacity(drive); |
Bartlomiej Zolnierkiewicz | 97100fc | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 481 | barrier = ata_id_flush_enabled(id) && |
| 482 | (drive->dev_flags & IDE_DFLAG_NOFLUSH) == 0 && |
| 483 | ((drive->dev_flags & IDE_DFLAG_LBA48) == 0 || |
| 484 | capacity <= (1ULL << 28) || |
Bartlomiej Zolnierkiewicz | ff2779b | 2008-10-10 22:39:31 +0200 | [diff] [blame] | 485 | ata_id_flush_ext_enabled(id)); |
Tejun Heo | 3e087b5 | 2006-01-06 09:57:31 +0100 | [diff] [blame] | 486 | |
| 487 | printk(KERN_INFO "%s: cache flushes %ssupported\n", |
Jean Delvare | f7ad836 | 2006-02-03 03:04:57 -0800 | [diff] [blame] | 488 | drive->name, barrier ? "" : "not "); |
Tejun Heo | 3e087b5 | 2006-01-06 09:57:31 +0100 | [diff] [blame] | 489 | |
| 490 | if (barrier) { |
| 491 | ordered = QUEUE_ORDERED_DRAIN_FLUSH; |
| 492 | prep_fn = idedisk_prepare_flush; |
Tejun Heo | 3e087b5 | 2006-01-06 09:57:31 +0100 | [diff] [blame] | 493 | } |
| 494 | } else |
| 495 | ordered = QUEUE_ORDERED_DRAIN; |
| 496 | |
| 497 | blk_queue_ordered(drive->queue, ordered, prep_fn); |
Tejun Heo | 3e087b5 | 2006-01-06 09:57:31 +0100 | [diff] [blame] | 498 | } |
| 499 | |
Bartlomiej Zolnierkiewicz | 97100fc | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 500 | ide_devset_get_flag(wcache, IDE_DFLAG_WCACHE); |
Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 501 | |
| 502 | static int set_wcache(ide_drive_t *drive, int arg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 503 | { |
Tejun Heo | 3e087b5 | 2006-01-06 09:57:31 +0100 | [diff] [blame] | 504 | int err = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 505 | |
Bartlomiej Zolnierkiewicz | 1497943 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 506 | if (arg < 0 || arg > 1) |
| 507 | return -EINVAL; |
| 508 | |
Bartlomiej Zolnierkiewicz | 4b58f17 | 2008-10-10 22:39:30 +0200 | [diff] [blame] | 509 | if (ata_id_flush_enabled(drive->id)) { |
Bartlomiej Zolnierkiewicz | be3c096 | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 510 | err = ide_do_setfeature(drive, |
| 511 | arg ? SETFEATURES_WC_ON : SETFEATURES_WC_OFF, 0); |
Bartlomiej Zolnierkiewicz | 97100fc | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 512 | if (err == 0) { |
| 513 | if (arg) |
| 514 | drive->dev_flags |= IDE_DFLAG_WCACHE; |
| 515 | else |
| 516 | drive->dev_flags &= ~IDE_DFLAG_WCACHE; |
| 517 | } |
Tejun Heo | 3e087b5 | 2006-01-06 09:57:31 +0100 | [diff] [blame] | 518 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 519 | |
Tejun Heo | 3e087b5 | 2006-01-06 09:57:31 +0100 | [diff] [blame] | 520 | update_ordered(drive); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 521 | |
Tejun Heo | 3e087b5 | 2006-01-06 09:57:31 +0100 | [diff] [blame] | 522 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 523 | } |
| 524 | |
Bartlomiej Zolnierkiewicz | 9841654 | 2008-04-26 17:36:37 +0200 | [diff] [blame] | 525 | static int do_idedisk_flushcache(ide_drive_t *drive) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 526 | { |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 527 | struct ide_cmd cmd; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 528 | |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 529 | memset(&cmd, 0, sizeof(cmd)); |
Bartlomiej Zolnierkiewicz | ff2779b | 2008-10-10 22:39:31 +0200 | [diff] [blame] | 530 | if (ata_id_flush_ext_enabled(drive->id)) |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 531 | cmd.tf.command = ATA_CMD_FLUSH_EXT; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 532 | else |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 533 | cmd.tf.command = ATA_CMD_FLUSH; |
| 534 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
| 535 | |
| 536 | return ide_no_data_taskfile(drive, &cmd); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 537 | } |
| 538 | |
Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 539 | ide_devset_get(acoustic, acoustic); |
| 540 | |
Bartlomiej Zolnierkiewicz | 9841654 | 2008-04-26 17:36:37 +0200 | [diff] [blame] | 541 | static int set_acoustic(ide_drive_t *drive, int arg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 542 | { |
Bartlomiej Zolnierkiewicz | 1497943 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 543 | if (arg < 0 || arg > 254) |
| 544 | return -EINVAL; |
| 545 | |
Bartlomiej Zolnierkiewicz | be3c096 | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 546 | ide_do_setfeature(drive, |
| 547 | arg ? SETFEATURES_AAM_ON : SETFEATURES_AAM_OFF, arg); |
| 548 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 549 | drive->acoustic = arg; |
Bartlomiej Zolnierkiewicz | be3c096 | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 550 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 551 | return 0; |
| 552 | } |
| 553 | |
Bartlomiej Zolnierkiewicz | 97100fc | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 554 | ide_devset_get_flag(addressing, IDE_DFLAG_LBA48); |
Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 555 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 556 | /* |
| 557 | * drive->addressing: |
| 558 | * 0: 28-bit |
| 559 | * 1: 48-bit |
| 560 | * 2: 48-bit capable doing 28-bit |
| 561 | */ |
Bartlomiej Zolnierkiewicz | aa768773 | 2008-10-10 22:39:33 +0200 | [diff] [blame] | 562 | static int set_addressing(ide_drive_t *drive, int arg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 563 | { |
Bartlomiej Zolnierkiewicz | 1497943 | 2007-05-10 00:01:10 +0200 | [diff] [blame] | 564 | if (arg < 0 || arg > 2) |
| 565 | return -EINVAL; |
| 566 | |
Bartlomiej Zolnierkiewicz | 35c1375 | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 567 | if (arg && ((drive->hwif->host_flags & IDE_HFLAG_NO_LBA48) || |
| 568 | ata_id_lba48_enabled(drive->id) == 0)) |
Bartlomiej Zolnierkiewicz | 9841654 | 2008-04-26 17:36:37 +0200 | [diff] [blame] | 569 | return -EIO; |
Bartlomiej Zolnierkiewicz | 942dcd8 | 2008-10-10 22:39:30 +0200 | [diff] [blame] | 570 | |
Bartlomiej Zolnierkiewicz | 35c1375 | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 571 | if (arg == 2) |
| 572 | arg = 0; |
| 573 | |
Bartlomiej Zolnierkiewicz | 97100fc | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 574 | if (arg) |
| 575 | drive->dev_flags |= IDE_DFLAG_LBA48; |
| 576 | else |
| 577 | drive->dev_flags &= ~IDE_DFLAG_LBA48; |
Bartlomiej Zolnierkiewicz | 942dcd8 | 2008-10-10 22:39:30 +0200 | [diff] [blame] | 578 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 579 | return 0; |
| 580 | } |
| 581 | |
Bartlomiej Zolnierkiewicz | f879048 | 2008-10-13 21:39:45 +0200 | [diff] [blame] | 582 | ide_ext_devset_rw(acoustic, acoustic); |
| 583 | ide_ext_devset_rw(address, addressing); |
| 584 | ide_ext_devset_rw(multcount, multcount); |
| 585 | ide_ext_devset_rw(wcache, wcache); |
Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 586 | |
Bartlomiej Zolnierkiewicz | f879048 | 2008-10-13 21:39:45 +0200 | [diff] [blame] | 587 | ide_ext_devset_rw_sync(nowerr, nowerr); |
Elias Oltmanns | 92f1f8f | 2008-10-10 22:39:40 +0200 | [diff] [blame] | 588 | |
Bartlomiej Zolnierkiewicz | 806f80a | 2008-10-17 18:09:14 +0200 | [diff] [blame] | 589 | static int ide_disk_check(ide_drive_t *drive, const char *s) |
| 590 | { |
| 591 | return 1; |
| 592 | } |
| 593 | |
| 594 | static void ide_disk_setup(ide_drive_t *drive) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 595 | { |
Bartlomiej Zolnierkiewicz | 1e874f4 | 2008-10-10 22:39:27 +0200 | [diff] [blame] | 596 | struct ide_disk_obj *idkp = drive->driver_data; |
Bartlomiej Zolnierkiewicz | c77380d | 2008-10-23 23:22:09 +0200 | [diff] [blame] | 597 | struct request_queue *q = drive->queue; |
Bartlomiej Zolnierkiewicz | 238e4f1 | 2007-10-19 00:30:07 +0200 | [diff] [blame] | 598 | ide_hwif_t *hwif = drive->hwif; |
Bartlomiej Zolnierkiewicz | 4dde449 | 2008-10-10 22:39:19 +0200 | [diff] [blame] | 599 | u16 *id = drive->id; |
| 600 | char *m = (char *)&id[ATA_ID_PROD]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 601 | unsigned long long capacity; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 602 | |
Bartlomiej Zolnierkiewicz | 1e874f4 | 2008-10-10 22:39:27 +0200 | [diff] [blame] | 603 | ide_proc_register_driver(drive, idkp->driver); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 604 | |
Bartlomiej Zolnierkiewicz | 97100fc | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 605 | if ((drive->dev_flags & IDE_DFLAG_ID_READ) == 0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 606 | return; |
| 607 | |
Bartlomiej Zolnierkiewicz | 97100fc | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 608 | if (drive->dev_flags & IDE_DFLAG_REMOVABLE) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 609 | /* |
Bartlomiej Zolnierkiewicz | 9841654 | 2008-04-26 17:36:37 +0200 | [diff] [blame] | 610 | * Removable disks (eg. SYQUEST); ignore 'WD' drives |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 611 | */ |
Bartlomiej Zolnierkiewicz | 4dde449 | 2008-10-10 22:39:19 +0200 | [diff] [blame] | 612 | if (m[0] != 'W' || m[1] != 'D') |
Bartlomiej Zolnierkiewicz | 97100fc | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 613 | drive->dev_flags |= IDE_DFLAG_DOORLOCKING; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 614 | } |
| 615 | |
Bartlomiej Zolnierkiewicz | aa768773 | 2008-10-10 22:39:33 +0200 | [diff] [blame] | 616 | (void)set_addressing(drive, 1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 617 | |
Bartlomiej Zolnierkiewicz | 97100fc | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 618 | if (drive->dev_flags & IDE_DFLAG_LBA48) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 619 | int max_s = 2048; |
| 620 | |
| 621 | if (max_s > hwif->rqsize) |
| 622 | max_s = hwif->rqsize; |
| 623 | |
Bartlomiej Zolnierkiewicz | c77380d | 2008-10-23 23:22:09 +0200 | [diff] [blame] | 624 | blk_queue_max_sectors(q, max_s); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 625 | } |
| 626 | |
Bartlomiej Zolnierkiewicz | 9841654 | 2008-04-26 17:36:37 +0200 | [diff] [blame] | 627 | printk(KERN_INFO "%s: max request size: %dKiB\n", drive->name, |
Bartlomiej Zolnierkiewicz | c77380d | 2008-10-23 23:22:09 +0200 | [diff] [blame] | 628 | q->max_sectors / 2); |
| 629 | |
Bartlomiej Zolnierkiewicz | 655772c | 2009-01-14 19:19:03 +0100 | [diff] [blame] | 630 | if (ata_id_is_ssd(id)) |
Bartlomiej Zolnierkiewicz | c77380d | 2008-10-23 23:22:09 +0200 | [diff] [blame] | 631 | queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 632 | |
| 633 | /* calculate drive capacity, and select LBA if possible */ |
Bartlomiej Zolnierkiewicz | 806f80a | 2008-10-17 18:09:14 +0200 | [diff] [blame] | 634 | ide_disk_get_capacity(drive); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 635 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 636 | /* |
| 637 | * if possible, give fdisk access to more of the drive, |
| 638 | * by correcting bios_cyls: |
| 639 | */ |
Bartlomiej Zolnierkiewicz | 5fef0e5 | 2008-10-17 18:09:12 +0200 | [diff] [blame] | 640 | capacity = ide_gd_capacity(drive); |
Bartlomiej Zolnierkiewicz | 9841654 | 2008-04-26 17:36:37 +0200 | [diff] [blame] | 641 | |
Bartlomiej Zolnierkiewicz | 97100fc | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 642 | if ((drive->dev_flags & IDE_DFLAG_FORCED_GEOM) == 0) { |
Bartlomiej Zolnierkiewicz | 942dcd8 | 2008-10-10 22:39:30 +0200 | [diff] [blame] | 643 | if (ata_id_lba48_enabled(drive->id)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 644 | /* compatibility */ |
| 645 | drive->bios_sect = 63; |
| 646 | drive->bios_head = 255; |
| 647 | } |
| 648 | |
| 649 | if (drive->bios_sect && drive->bios_head) { |
| 650 | unsigned int cap0 = capacity; /* truncate to 32 bits */ |
| 651 | unsigned int cylsz, cyl; |
| 652 | |
| 653 | if (cap0 != capacity) |
| 654 | drive->bios_cyl = 65535; |
| 655 | else { |
| 656 | cylsz = drive->bios_sect * drive->bios_head; |
| 657 | cyl = cap0 / cylsz; |
| 658 | if (cyl > 65535) |
| 659 | cyl = 65535; |
| 660 | if (cyl > drive->bios_cyl) |
| 661 | drive->bios_cyl = cyl; |
| 662 | } |
| 663 | } |
| 664 | } |
| 665 | printk(KERN_INFO "%s: %llu sectors (%llu MB)", |
| 666 | drive->name, capacity, sectors_to_MB(capacity)); |
| 667 | |
| 668 | /* Only print cache size when it was specified */ |
Bartlomiej Zolnierkiewicz | 4dde449 | 2008-10-10 22:39:19 +0200 | [diff] [blame] | 669 | if (id[ATA_ID_BUF_SIZE]) |
| 670 | printk(KERN_CONT " w/%dKiB Cache", id[ATA_ID_BUF_SIZE] / 2); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 671 | |
Bartlomiej Zolnierkiewicz | 3ab7efe | 2007-12-12 23:31:58 +0100 | [diff] [blame] | 672 | printk(KERN_CONT ", CHS=%d/%d/%d\n", |
| 673 | drive->bios_cyl, drive->bios_head, drive->bios_sect); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 674 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 675 | /* write cache enabled? */ |
Bartlomiej Zolnierkiewicz | 8a089c6 | 2008-10-10 22:39:20 +0200 | [diff] [blame] | 676 | if ((id[ATA_ID_CSFO] & 1) || ata_id_wcache_enabled(id)) |
Bartlomiej Zolnierkiewicz | 97100fc | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 677 | drive->dev_flags |= IDE_DFLAG_WCACHE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 678 | |
Bartlomiej Zolnierkiewicz | 8185d5a | 2008-10-10 22:39:28 +0200 | [diff] [blame] | 679 | set_wcache(drive, 1); |
Bartlomiej Zolnierkiewicz | ae9f9f0 | 2008-10-17 18:09:10 +0200 | [diff] [blame] | 680 | |
| 681 | if ((drive->dev_flags & IDE_DFLAG_LBA) == 0 && |
| 682 | (drive->head == 0 || drive->head > 16)) { |
| 683 | printk(KERN_ERR "%s: invalid geometry: %d physical heads?\n", |
| 684 | drive->name, drive->head); |
| 685 | drive->dev_flags &= ~IDE_DFLAG_ATTACH; |
| 686 | } else |
| 687 | drive->dev_flags |= IDE_DFLAG_ATTACH; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 688 | } |
| 689 | |
Bartlomiej Zolnierkiewicz | 806f80a | 2008-10-17 18:09:14 +0200 | [diff] [blame] | 690 | static void ide_disk_flush(ide_drive_t *drive) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 691 | { |
Bartlomiej Zolnierkiewicz | 97100fc | 2008-10-13 21:39:36 +0200 | [diff] [blame] | 692 | if (ata_id_flush_enabled(drive->id) == 0 || |
| 693 | (drive->dev_flags & IDE_DFLAG_WCACHE) == 0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 694 | return; |
| 695 | |
| 696 | if (do_idedisk_flushcache(drive)) |
| 697 | printk(KERN_INFO "%s: wcache flush failed!\n", drive->name); |
| 698 | } |
| 699 | |
Bartlomiej Zolnierkiewicz | 806f80a | 2008-10-17 18:09:14 +0200 | [diff] [blame] | 700 | static int ide_disk_init_media(ide_drive_t *drive, struct gendisk *disk) |
| 701 | { |
| 702 | return 0; |
| 703 | } |
| 704 | |
| 705 | static int ide_disk_set_doorlock(ide_drive_t *drive, struct gendisk *disk, |
| 706 | int on) |
Bartlomiej Zolnierkiewicz | 29ec683 | 2008-01-26 20:12:59 +0100 | [diff] [blame] | 707 | { |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 708 | struct ide_cmd cmd; |
Bartlomiej Zolnierkiewicz | 81ee1bb | 2008-10-17 18:09:10 +0200 | [diff] [blame] | 709 | int ret; |
| 710 | |
| 711 | if ((drive->dev_flags & IDE_DFLAG_DOORLOCKING) == 0) |
| 712 | return 0; |
Bartlomiej Zolnierkiewicz | 29ec683 | 2008-01-26 20:12:59 +0100 | [diff] [blame] | 713 | |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 714 | memset(&cmd, 0, sizeof(cmd)); |
| 715 | cmd.tf.command = on ? ATA_CMD_MEDIA_LOCK : ATA_CMD_MEDIA_UNLOCK; |
| 716 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
Bartlomiej Zolnierkiewicz | 29ec683 | 2008-01-26 20:12:59 +0100 | [diff] [blame] | 717 | |
Bartlomiej Zolnierkiewicz | 22aa4b3 | 2009-03-27 12:46:37 +0100 | [diff] [blame] | 718 | ret = ide_no_data_taskfile(drive, &cmd); |
Bartlomiej Zolnierkiewicz | 81ee1bb | 2008-10-17 18:09:10 +0200 | [diff] [blame] | 719 | |
| 720 | if (ret) |
| 721 | drive->dev_flags &= ~IDE_DFLAG_DOORLOCKING; |
| 722 | |
| 723 | return ret; |
Bartlomiej Zolnierkiewicz | 29ec683 | 2008-01-26 20:12:59 +0100 | [diff] [blame] | 724 | } |
Bartlomiej Zolnierkiewicz | 806f80a | 2008-10-17 18:09:14 +0200 | [diff] [blame] | 725 | |
| 726 | const struct ide_disk_ops ide_ata_disk_ops = { |
| 727 | .check = ide_disk_check, |
| 728 | .get_capacity = ide_disk_get_capacity, |
| 729 | .setup = ide_disk_setup, |
| 730 | .flush = ide_disk_flush, |
| 731 | .init_media = ide_disk_init_media, |
| 732 | .set_doorlock = ide_disk_set_doorlock, |
| 733 | .do_request = ide_do_rw_disk, |
Bartlomiej Zolnierkiewicz | 806f80a | 2008-10-17 18:09:14 +0200 | [diff] [blame] | 734 | .ioctl = ide_disk_ioctl, |
| 735 | }; |