aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/Kconfig4
-rw-r--r--drivers/ide/ide-cd.c91
-rw-r--r--drivers/ide/ide-disk.c3
-rw-r--r--drivers/ide/ide-floppy.c6
-rw-r--r--drivers/ide/ide-probe.c8
-rw-r--r--drivers/ide/pci/amd74xx.c3
-rw-r--r--drivers/ide/pci/sgiioc4.c30
7 files changed, 93 insertions, 52 deletions
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 3ac0a535b4aa..0273f124a4f7 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -672,8 +672,8 @@ config BLK_DEV_SVWKS
672 chipsets. 672 chipsets.
673 673
674config BLK_DEV_SGIIOC4 674config BLK_DEV_SGIIOC4
675 tristate "Silicon Graphics IOC4 chipset support" 675 tristate "Silicon Graphics IOC4 chipset ATA/ATAPI support"
676 depends on IA64_SGI_SN2 || IA64_GENERIC 676 depends on (IA64_SGI_SN2 || IA64_GENERIC) && SGI_IOC4
677 help 677 help
678 This driver adds PIO & MultiMode DMA-2 support for the SGI IOC4 678 This driver adds PIO & MultiMode DMA-2 support for the SGI IOC4
679 chipset, which has one channel and can support two devices. 679 chipset, which has one channel and can support two devices.
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 78e3e7b24d7d..0a31cfda08a0 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1936,7 +1936,7 @@ static ide_startstop_t cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
1936 * NOTE! The "len" and "addr" checks should possibly have 1936 * NOTE! The "len" and "addr" checks should possibly have
1937 * separate masks. 1937 * separate masks.
1938 */ 1938 */
1939 if ((rq->data_len & mask) || (addr & mask)) 1939 if ((rq->data_len & 15) || (addr & mask))
1940 info->dma = 0; 1940 info->dma = 0;
1941 } 1941 }
1942 1942
@@ -2657,16 +2657,63 @@ int ide_cdrom_lock_door (struct cdrom_device_info *cdi, int lock)
2657} 2657}
2658 2658
2659static 2659static
2660int ide_cdrom_get_capabilities(ide_drive_t *drive, struct atapi_capabilities_page *cap)
2661{
2662 struct cdrom_info *info = drive->driver_data;
2663 struct cdrom_device_info *cdi = &info->devinfo;
2664 struct packet_command cgc;
2665 int stat, attempts = 3, size = sizeof(*cap);
2666
2667 /*
2668 * ACER50 (and others?) require the full spec length mode sense
2669 * page capabilities size, but older drives break.
2670 */
2671 if (!(!strcmp(drive->id->model, "ATAPI CD ROM DRIVE 50X MAX") ||
2672 !strcmp(drive->id->model, "WPI CDS-32X")))
2673 size -= sizeof(cap->pad);
2674
2675 init_cdrom_command(&cgc, cap, size, CGC_DATA_UNKNOWN);
2676 do { /* we seem to get stat=0x01,err=0x00 the first time (??) */
2677 stat = cdrom_mode_sense(cdi, &cgc, GPMODE_CAPABILITIES_PAGE, 0);
2678 if (!stat)
2679 break;
2680 } while (--attempts);
2681 return stat;
2682}
2683
2684static
2685void ide_cdrom_update_speed (ide_drive_t *drive, struct atapi_capabilities_page *cap)
2686{
2687 /* The ACER/AOpen 24X cdrom has the speed fields byte-swapped */
2688 if (!drive->id->model[0] &&
2689 !strncmp(drive->id->fw_rev, "241N", 4)) {
2690 CDROM_STATE_FLAGS(drive)->current_speed =
2691 (((unsigned int)cap->curspeed) + (176/2)) / 176;
2692 CDROM_CONFIG_FLAGS(drive)->max_speed =
2693 (((unsigned int)cap->maxspeed) + (176/2)) / 176;
2694 } else {
2695 CDROM_STATE_FLAGS(drive)->current_speed =
2696 (ntohs(cap->curspeed) + (176/2)) / 176;
2697 CDROM_CONFIG_FLAGS(drive)->max_speed =
2698 (ntohs(cap->maxspeed) + (176/2)) / 176;
2699 }
2700}
2701
2702static
2660int ide_cdrom_select_speed (struct cdrom_device_info *cdi, int speed) 2703int ide_cdrom_select_speed (struct cdrom_device_info *cdi, int speed)
2661{ 2704{
2662 ide_drive_t *drive = (ide_drive_t*) cdi->handle; 2705 ide_drive_t *drive = (ide_drive_t*) cdi->handle;
2663 struct request_sense sense; 2706 struct request_sense sense;
2707 struct atapi_capabilities_page cap;
2664 int stat; 2708 int stat;
2665 2709
2666 if ((stat = cdrom_select_speed(drive, speed, &sense)) < 0) 2710 if ((stat = cdrom_select_speed(drive, speed, &sense)) < 0)
2667 return stat; 2711 return stat;
2668 2712
2669 cdi->speed = CDROM_STATE_FLAGS(drive)->current_speed; 2713 if (!ide_cdrom_get_capabilities(drive, &cap)) {
2714 ide_cdrom_update_speed(drive, &cap);
2715 cdi->speed = CDROM_STATE_FLAGS(drive)->current_speed;
2716 }
2670 return 0; 2717 return 0;
2671} 2718}
2672 2719
@@ -2869,31 +2916,6 @@ static int ide_cdrom_register (ide_drive_t *drive, int nslots)
2869} 2916}
2870 2917
2871static 2918static
2872int ide_cdrom_get_capabilities(ide_drive_t *drive, struct atapi_capabilities_page *cap)
2873{
2874 struct cdrom_info *info = drive->driver_data;
2875 struct cdrom_device_info *cdi = &info->devinfo;
2876 struct packet_command cgc;
2877 int stat, attempts = 3, size = sizeof(*cap);
2878
2879 /*
2880 * ACER50 (and others?) require the full spec length mode sense
2881 * page capabilities size, but older drives break.
2882 */
2883 if (!(!strcmp(drive->id->model, "ATAPI CD ROM DRIVE 50X MAX") ||
2884 !strcmp(drive->id->model, "WPI CDS-32X")))
2885 size -= sizeof(cap->pad);
2886
2887 init_cdrom_command(&cgc, cap, size, CGC_DATA_UNKNOWN);
2888 do { /* we seem to get stat=0x01,err=0x00 the first time (??) */
2889 stat = cdrom_mode_sense(cdi, &cgc, GPMODE_CAPABILITIES_PAGE, 0);
2890 if (!stat)
2891 break;
2892 } while (--attempts);
2893 return stat;
2894}
2895
2896static
2897int ide_cdrom_probe_capabilities (ide_drive_t *drive) 2919int ide_cdrom_probe_capabilities (ide_drive_t *drive)
2898{ 2920{
2899 struct cdrom_info *info = drive->driver_data; 2921 struct cdrom_info *info = drive->driver_data;
@@ -2978,20 +3000,7 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
2978 } 3000 }
2979 } 3001 }
2980 3002
2981 /* The ACER/AOpen 24X cdrom has the speed fields byte-swapped */ 3003 ide_cdrom_update_speed(drive, &cap);
2982 if (!drive->id->model[0] &&
2983 !strncmp(drive->id->fw_rev, "241N", 4)) {
2984 CDROM_STATE_FLAGS(drive)->current_speed =
2985 (((unsigned int)cap.curspeed) + (176/2)) / 176;
2986 CDROM_CONFIG_FLAGS(drive)->max_speed =
2987 (((unsigned int)cap.maxspeed) + (176/2)) / 176;
2988 } else {
2989 CDROM_STATE_FLAGS(drive)->current_speed =
2990 (ntohs(cap.curspeed) + (176/2)) / 176;
2991 CDROM_CONFIG_FLAGS(drive)->max_speed =
2992 (ntohs(cap.maxspeed) + (176/2)) / 176;
2993 }
2994
2995 /* don't print speed if the drive reported 0. 3004 /* don't print speed if the drive reported 0.
2996 */ 3005 */
2997 printk(KERN_INFO "%s: ATAPI", drive->name); 3006 printk(KERN_INFO "%s: ATAPI", drive->name);
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 3302cd8eab4c..d6f934886b04 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -1215,7 +1215,8 @@ static int ide_disk_probe(struct device *dev)
1215 if (!idkp) 1215 if (!idkp)
1216 goto failed; 1216 goto failed;
1217 1217
1218 g = alloc_disk(1 << PARTN_BITS); 1218 g = alloc_disk_node(1 << PARTN_BITS,
1219 pcibus_to_node(drive->hwif->pci_dev->bus));
1219 if (!g) 1220 if (!g)
1220 goto out_free_idkp; 1221 goto out_free_idkp;
1221 1222
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index c949e98df4b6..9eab6426148e 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -661,10 +661,12 @@ static void idefloppy_output_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, un
661 661
662 idefloppy_do_end_request(drive, 1, done >> 9); 662 idefloppy_do_end_request(drive, 1, done >> 9);
663 663
664#if IDEFLOPPY_DEBUG_BUGS
664 if (bcount) { 665 if (bcount) {
665 printk(KERN_ERR "%s: leftover data in idefloppy_output_buffers, bcount == %d\n", drive->name, bcount); 666 printk(KERN_ERR "%s: leftover data in idefloppy_output_buffers, bcount == %d\n", drive->name, bcount);
666 idefloppy_write_zeros(drive, bcount); 667 idefloppy_write_zeros(drive, bcount);
667 } 668 }
669#endif
668} 670}
669 671
670static void idefloppy_update_buffers (ide_drive_t *drive, idefloppy_pc_t *pc) 672static void idefloppy_update_buffers (ide_drive_t *drive, idefloppy_pc_t *pc)
@@ -1048,6 +1050,9 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p
1048 atapi_bcount_t bcount; 1050 atapi_bcount_t bcount;
1049 ide_handler_t *pkt_xfer_routine; 1051 ide_handler_t *pkt_xfer_routine;
1050 1052
1053#if 0 /* Accessing floppy->pc is not valid here, the previous pc may be gone
1054 and have lived on another thread's stack; that stack may have become
1055 unmapped meanwhile (CONFIG_DEBUG_PAGEALLOC). */
1051#if IDEFLOPPY_DEBUG_BUGS 1056#if IDEFLOPPY_DEBUG_BUGS
1052 if (floppy->pc->c[0] == IDEFLOPPY_REQUEST_SENSE_CMD && 1057 if (floppy->pc->c[0] == IDEFLOPPY_REQUEST_SENSE_CMD &&
1053 pc->c[0] == IDEFLOPPY_REQUEST_SENSE_CMD) { 1058 pc->c[0] == IDEFLOPPY_REQUEST_SENSE_CMD) {
@@ -1055,6 +1060,7 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p
1055 "Two request sense in serial were issued\n"); 1060 "Two request sense in serial were issued\n");
1056 } 1061 }
1057#endif /* IDEFLOPPY_DEBUG_BUGS */ 1062#endif /* IDEFLOPPY_DEBUG_BUGS */
1063#endif
1058 1064
1059 if (floppy->failed_pc == NULL && 1065 if (floppy->failed_pc == NULL &&
1060 pc->c[0] != IDEFLOPPY_REQUEST_SENSE_CMD) 1066 pc->c[0] != IDEFLOPPY_REQUEST_SENSE_CMD)
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 5d876f53c697..7df85af75371 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -977,8 +977,9 @@ static int ide_init_queue(ide_drive_t *drive)
977 * limits and LBA48 we could raise it but as yet 977 * limits and LBA48 we could raise it but as yet
978 * do not. 978 * do not.
979 */ 979 */
980 980
981 q = blk_init_queue(do_ide_request, &ide_lock); 981 q = blk_init_queue_node(do_ide_request, &ide_lock,
982 pcibus_to_node(drive->hwif->pci_dev->bus));
982 if (!q) 983 if (!q)
983 return 1; 984 return 1;
984 985
@@ -1095,7 +1096,8 @@ static int init_irq (ide_hwif_t *hwif)
1095 hwgroup->hwif->next = hwif; 1096 hwgroup->hwif->next = hwif;
1096 spin_unlock_irq(&ide_lock); 1097 spin_unlock_irq(&ide_lock);
1097 } else { 1098 } else {
1098 hwgroup = kmalloc(sizeof(ide_hwgroup_t),GFP_KERNEL); 1099 hwgroup = kmalloc_node(sizeof(ide_hwgroup_t), GFP_KERNEL,
1100 pcibus_to_node(hwif->drives[0].hwif->pci_dev->bus));
1099 if (!hwgroup) 1101 if (!hwgroup)
1100 goto out_up; 1102 goto out_up;
1101 1103
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c
index 47225e324356..4e0f13d1d060 100644
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -72,6 +72,7 @@ static struct amd_ide_chip {
72 { PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2, 0x50, AMD_UDMA_133 }, 72 { PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2, 0x50, AMD_UDMA_133 },
73 { PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE, 0x50, AMD_UDMA_133 }, 73 { PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE, 0x50, AMD_UDMA_133 },
74 { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE, 0x50, AMD_UDMA_133 }, 74 { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE, 0x50, AMD_UDMA_133 },
75 { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE, 0x50, AMD_UDMA_133 },
75 { 0 } 76 { 0 }
76}; 77};
77 78
@@ -487,6 +488,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
487 /* 12 */ DECLARE_NV_DEV("NFORCE3-250-SATA2"), 488 /* 12 */ DECLARE_NV_DEV("NFORCE3-250-SATA2"),
488 /* 13 */ DECLARE_NV_DEV("NFORCE-CK804"), 489 /* 13 */ DECLARE_NV_DEV("NFORCE-CK804"),
489 /* 14 */ DECLARE_NV_DEV("NFORCE-MCP04"), 490 /* 14 */ DECLARE_NV_DEV("NFORCE-MCP04"),
491 /* 15 */ DECLARE_NV_DEV("NFORCE-MCP51"),
490}; 492};
491 493
492static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id) 494static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id)
@@ -521,6 +523,7 @@ static struct pci_device_id amd74xx_pci_tbl[] = {
521#endif 523#endif
522 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 13 }, 524 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 13 },
523 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 14 }, 525 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 14 },
526 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 15 },
524 { 0, }, 527 { 0, },
525}; 528};
526MODULE_DEVICE_TABLE(pci, amd74xx_pci_tbl); 529MODULE_DEVICE_TABLE(pci, amd74xx_pci_tbl);
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index 4651a22bf12e..af526b671c4e 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -34,7 +34,7 @@
34#include <linux/mm.h> 34#include <linux/mm.h>
35#include <linux/ioport.h> 35#include <linux/ioport.h>
36#include <linux/blkdev.h> 36#include <linux/blkdev.h>
37#include <linux/ioc4_common.h> 37#include <linux/ioc4.h>
38#include <asm/io.h> 38#include <asm/io.h>
39 39
40#include <linux/ide.h> 40#include <linux/ide.h>
@@ -715,14 +715,34 @@ static ide_pci_device_t sgiioc4_chipsets[] __devinitdata = {
715}; 715};
716 716
717int 717int
718ioc4_ide_attach_one(struct pci_dev *dev, const struct pci_device_id *id) 718ioc4_ide_attach_one(struct ioc4_driver_data *idd)
719{ 719{
720 return pci_init_sgiioc4(dev, &sgiioc4_chipsets[id->driver_data]); 720 return pci_init_sgiioc4(idd->idd_pdev,
721 &sgiioc4_chipsets[idd->idd_pci_id->driver_data]);
721} 722}
722 723
724static struct ioc4_submodule ioc4_ide_submodule = {
725 .is_name = "IOC4_ide",
726 .is_owner = THIS_MODULE,
727 .is_probe = ioc4_ide_attach_one,
728/* .is_remove = ioc4_ide_remove_one, */
729};
730
731static int __devinit
732ioc4_ide_init(void)
733{
734 return ioc4_register_submodule(&ioc4_ide_submodule);
735}
736
737static void __devexit
738ioc4_ide_exit(void)
739{
740 ioc4_unregister_submodule(&ioc4_ide_submodule);
741}
742
743module_init(ioc4_ide_init);
744module_exit(ioc4_ide_exit);
723 745
724MODULE_AUTHOR("Aniket Malatpure - Silicon Graphics Inc. (SGI)"); 746MODULE_AUTHOR("Aniket Malatpure - Silicon Graphics Inc. (SGI)");
725MODULE_DESCRIPTION("IDE PCI driver module for SGI IOC4 Base-IO Card"); 747MODULE_DESCRIPTION("IDE PCI driver module for SGI IOC4 Base-IO Card");
726MODULE_LICENSE("GPL"); 748MODULE_LICENSE("GPL");
727
728EXPORT_SYMBOL(ioc4_ide_attach_one);