aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-cs.c24
-rw-r--r--drivers/ide/ide-disk.c40
-rw-r--r--drivers/ide/ide-gd.c11
3 files changed, 31 insertions, 44 deletions
diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c
index ab87e4f7cec9..0b7815d2581c 100644
--- a/drivers/ide/ide-cs.c
+++ b/drivers/ide/ide-cs.c
@@ -65,8 +65,7 @@ MODULE_LICENSE("Dual MPL/GPL");
65typedef struct ide_info_t { 65typedef struct ide_info_t {
66 struct pcmcia_device *p_dev; 66 struct pcmcia_device *p_dev;
67 struct ide_host *host; 67 struct ide_host *host;
68 int ndev; 68 int ndev;
69 dev_node_t node;
70} ide_info_t; 69} ide_info_t;
71 70
72static void ide_release(struct pcmcia_device *); 71static void ide_release(struct pcmcia_device *);
@@ -102,7 +101,6 @@ static int ide_probe(struct pcmcia_device *link)
102 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 101 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
103 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 102 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
104 link->io.IOAddrLines = 3; 103 link->io.IOAddrLines = 3;
105 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
106 link->conf.Attributes = CONF_ENABLE_IRQ; 104 link->conf.Attributes = CONF_ENABLE_IRQ;
107 link->conf.IntType = INT_MEMORY_AND_IO; 105 link->conf.IntType = INT_MEMORY_AND_IO;
108 106
@@ -285,8 +283,7 @@ static int ide_config(struct pcmcia_device *link)
285 io_base = link->io.BasePort1; 283 io_base = link->io.BasePort1;
286 ctl_base = stk->ctl_base; 284 ctl_base = stk->ctl_base;
287 285
288 ret = pcmcia_request_irq(link, &link->irq); 286 if (!link->irq)
289 if (ret)
290 goto failed; 287 goto failed;
291 ret = pcmcia_request_configuration(link, &link->conf); 288 ret = pcmcia_request_configuration(link, &link->conf);
292 if (ret) 289 if (ret)
@@ -299,24 +296,21 @@ static int ide_config(struct pcmcia_device *link)
299 if (is_kme) 296 if (is_kme)
300 outb(0x81, ctl_base+1); 297 outb(0x81, ctl_base+1);
301 298
302 host = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link); 299 host = idecs_register(io_base, ctl_base, link->irq, link);
303 if (host == NULL && link->io.NumPorts1 == 0x20) { 300 if (host == NULL && link->io.NumPorts1 == 0x20) {
304 outb(0x02, ctl_base + 0x10); 301 outb(0x02, ctl_base + 0x10);
305 host = idecs_register(io_base + 0x10, ctl_base + 0x10, 302 host = idecs_register(io_base + 0x10, ctl_base + 0x10,
306 link->irq.AssignedIRQ, link); 303 link->irq, link);
307 } 304 }
308 305
309 if (host == NULL) 306 if (host == NULL)
310 goto failed; 307 goto failed;
311 308
312 info->ndev = 1; 309 info->ndev = 1;
313 sprintf(info->node.dev_name, "hd%c", 'a' + host->ports[0]->index * 2);
314 info->node.major = host->ports[0]->major;
315 info->node.minor = 0;
316 info->host = host; 310 info->host = host;
317 link->dev_node = &info->node; 311 dev_info(&link->dev, "ide-cs: hd%c: Vpp = %d.%d\n",
318 printk(KERN_INFO "ide-cs: %s: Vpp = %d.%d\n", 312 'a' + host->ports[0]->index * 2,
319 info->node.dev_name, link->conf.Vpp / 10, link->conf.Vpp % 10); 313 link->conf.Vpp / 10, link->conf.Vpp % 10);
320 314
321 kfree(stk); 315 kfree(stk);
322 return 0; 316 return 0;
@@ -409,6 +403,8 @@ static struct pcmcia_device_id ide_ids[] = {
409 PCMCIA_DEVICE_PROD_ID12("Hyperstone", "Model1", 0x3d5b9ef5, 0xca6ab420), 403 PCMCIA_DEVICE_PROD_ID12("Hyperstone", "Model1", 0x3d5b9ef5, 0xca6ab420),
410 PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178), 404 PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178),
411 PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753), 405 PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753),
406 PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF CARD 1GB", 0x2e6d1829, 0x55d5bffb),
407 PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF CARD 4GB", 0x2e6d1829, 0x531e7d10),
412 PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF8GB", 0x2e6d1829, 0xacbe682e), 408 PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF8GB", 0x2e6d1829, 0xacbe682e),
413 PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b), 409 PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b),
414 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149), 410 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149),
@@ -429,6 +425,8 @@ static struct pcmcia_device_id ide_ids[] = {
429 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS1GCF80", 0x709b1bf1, 0x2a54d4b1), 425 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS1GCF80", 0x709b1bf1, 0x2a54d4b1),
430 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS2GCF120", 0x709b1bf1, 0x969aa4f2), 426 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS2GCF120", 0x709b1bf1, 0x969aa4f2),
431 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF120", 0x709b1bf1, 0xf54a91c8), 427 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF120", 0x709b1bf1, 0xf54a91c8),
428 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF133", 0x709b1bf1, 0x7558f133),
429 PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS8GCF133", 0x709b1bf1, 0xb2f89b47),
432 PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852), 430 PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852),
433 PCMCIA_DEVICE_PROD_ID12("WEIDA", "TWTTI", 0xcc7cf69c, 0x212bb918), 431 PCMCIA_DEVICE_PROD_ID12("WEIDA", "TWTTI", 0xcc7cf69c, 0x212bb918),
434 PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209), 432 PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209),
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 3b128dce9c3a..33d65039cce9 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -407,32 +407,24 @@ static int ide_disk_get_capacity(ide_drive_t *drive)
407 return 0; 407 return 0;
408} 408}
409 409
410static u64 ide_disk_set_capacity(ide_drive_t *drive, u64 capacity) 410static void ide_disk_unlock_native_capacity(ide_drive_t *drive)
411{ 411{
412 u64 set = min(capacity, drive->probed_capacity);
413 u16 *id = drive->id; 412 u16 *id = drive->id;
414 int lba48 = ata_id_lba48_enabled(id); 413 int lba48 = ata_id_lba48_enabled(id);
415 414
416 if ((drive->dev_flags & IDE_DFLAG_LBA) == 0 || 415 if ((drive->dev_flags & IDE_DFLAG_LBA) == 0 ||
417 ata_id_hpa_enabled(id) == 0) 416 ata_id_hpa_enabled(id) == 0)
418 goto out; 417 return;
419 418
420 /* 419 /*
421 * according to the spec the SET MAX ADDRESS command shall be 420 * according to the spec the SET MAX ADDRESS command shall be
422 * immediately preceded by a READ NATIVE MAX ADDRESS command 421 * immediately preceded by a READ NATIVE MAX ADDRESS command
423 */ 422 */
424 capacity = ide_disk_hpa_get_native_capacity(drive, lba48); 423 if (!ide_disk_hpa_get_native_capacity(drive, lba48))
425 if (capacity == 0) 424 return;
426 goto out; 425
427 426 if (ide_disk_hpa_set_capacity(drive, drive->probed_capacity, lba48))
428 set = ide_disk_hpa_set_capacity(drive, set, lba48); 427 drive->dev_flags |= IDE_DFLAG_NOHPA; /* disable HPA on resume */
429 if (set) {
430 /* needed for ->resume to disable HPA */
431 drive->dev_flags |= IDE_DFLAG_NOHPA;
432 return set;
433 }
434out:
435 return drive->capacity64;
436} 428}
437 429
438static void idedisk_prepare_flush(struct request_queue *q, struct request *rq) 430static void idedisk_prepare_flush(struct request_queue *q, struct request *rq)
@@ -783,13 +775,13 @@ static int ide_disk_set_doorlock(ide_drive_t *drive, struct gendisk *disk,
783} 775}
784 776
785const struct ide_disk_ops ide_ata_disk_ops = { 777const struct ide_disk_ops ide_ata_disk_ops = {
786 .check = ide_disk_check, 778 .check = ide_disk_check,
787 .set_capacity = ide_disk_set_capacity, 779 .unlock_native_capacity = ide_disk_unlock_native_capacity,
788 .get_capacity = ide_disk_get_capacity, 780 .get_capacity = ide_disk_get_capacity,
789 .setup = ide_disk_setup, 781 .setup = ide_disk_setup,
790 .flush = ide_disk_flush, 782 .flush = ide_disk_flush,
791 .init_media = ide_disk_init_media, 783 .init_media = ide_disk_init_media,
792 .set_doorlock = ide_disk_set_doorlock, 784 .set_doorlock = ide_disk_set_doorlock,
793 .do_request = ide_do_rw_disk, 785 .do_request = ide_do_rw_disk,
794 .ioctl = ide_disk_ioctl, 786 .ioctl = ide_disk_ioctl,
795}; 787};
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c
index c32d83996ae1..c102d23d9b38 100644
--- a/drivers/ide/ide-gd.c
+++ b/drivers/ide/ide-gd.c
@@ -288,17 +288,14 @@ static int ide_gd_media_changed(struct gendisk *disk)
288 return ret; 288 return ret;
289} 289}
290 290
291static unsigned long long ide_gd_set_capacity(struct gendisk *disk, 291static void ide_gd_unlock_native_capacity(struct gendisk *disk)
292 unsigned long long capacity)
293{ 292{
294 struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); 293 struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj);
295 ide_drive_t *drive = idkp->drive; 294 ide_drive_t *drive = idkp->drive;
296 const struct ide_disk_ops *disk_ops = drive->disk_ops; 295 const struct ide_disk_ops *disk_ops = drive->disk_ops;
297 296
298 if (disk_ops->set_capacity) 297 if (disk_ops->unlock_native_capacity)
299 return disk_ops->set_capacity(drive, capacity); 298 disk_ops->unlock_native_capacity(drive);
300
301 return drive->capacity64;
302} 299}
303 300
304static int ide_gd_revalidate_disk(struct gendisk *disk) 301static int ide_gd_revalidate_disk(struct gendisk *disk)
@@ -329,7 +326,7 @@ static const struct block_device_operations ide_gd_ops = {
329 .locked_ioctl = ide_gd_ioctl, 326 .locked_ioctl = ide_gd_ioctl,
330 .getgeo = ide_gd_getgeo, 327 .getgeo = ide_gd_getgeo,
331 .media_changed = ide_gd_media_changed, 328 .media_changed = ide_gd_media_changed,
332 .set_capacity = ide_gd_set_capacity, 329 .unlock_native_capacity = ide_gd_unlock_native_capacity,
333 .revalidate_disk = ide_gd_revalidate_disk 330 .revalidate_disk = ide_gd_revalidate_disk
334}; 331};
335 332