From e79f8126799775fa48d8b39ad31cb518101b61e2 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Fri, 1 Feb 2008 23:09:15 +0100 Subject: Atari Falcon IDE: Add missing hwif variable Commit cbb010c180294a5242a7681555c28737d9dd26ab ide: drop 'initializing' argument from ide_register_hw() * Rename init_hwif_data() to ide_init_port_data() and export it. * For all users of ide_register_hw() with 'initializing' argument set hwif->present and hwif->hold are always zero so convert these host drivers to use ide_find_port()+ide_init_port_data()+ide_init_port_hw() instead (also no need for init_hwif_default() call since the setup done by it gets over-ridden by ide_init_port_hw() call). * Drop 'initializing' argument from ide_register_hw(). introduced the usage of a hwif variable, but forgot to declare the actual variable. Signed-off-by: Geert Uytterhoeven Cc: Sergei Shtylyov Signed-off-by: Andrew Morton Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/legacy/falconide.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers') diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c index 2860956bdcb0..53b912a7699d 100644 --- a/drivers/ide/legacy/falconide.c +++ b/drivers/ide/legacy/falconide.c @@ -66,6 +66,7 @@ static int __init falconide_init(void) { if (MACH_IS_ATARI && ATARIHW_PRESENT(IDE)) { hw_regs_t hw; + ide_hwif_t *hwif; printk(KERN_INFO "ide: Falcon IDE controller\n"); -- cgit v1.2.3 From e665d50543981efef940178b95994b73ec41b77d Mon Sep 17 00:00:00 2001 From: Frans Pop Date: Fri, 1 Feb 2008 23:09:16 +0100 Subject: ide/Kconfig: use 'on-board' instead of 'built-in' in config options To avoid confusion between 'built-in' drivers and 'on-board' controllers, consistently use the term 'on-board' for controllers. Minor line-wrapping improvements in descriptions for config options. [ Bart: thanks to Jan for 'built-in'->'on-board' suggestion ] Signed-off-by: Frans Pop Cc: Jan Engelhardt Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/Kconfig | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index 64df55e20ab5..92b01170d8f3 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig @@ -617,8 +617,8 @@ config BLK_DEV_SC1200 tristate "National SCx200 chipset support" select BLK_DEV_IDEDMA_PCI help - This driver adds support for the built in IDE on the National - SCx200 series of embedded x86 "Geode" systems + This driver adds support for the on-board IDE controller on the + National SCx200 series of embedded x86 "Geode" systems. config BLK_DEV_PIIX tristate "Intel PIIXn chipsets support" @@ -793,22 +793,22 @@ config BLK_DEV_CELLEB depends on PPC_CELLEB select BLK_DEV_IDEDMA_PCI help - This driver provides support for the built-in IDE controller on + This driver provides support for the on-board IDE controller on Toshiba Cell Reference Board. If unsure, say Y. endif config BLK_DEV_IDE_PMAC - tristate "Builtin PowerMac IDE support" + tristate "PowerMac on-board IDE support" depends on PPC_PMAC && IDE=y && BLK_DEV_IDE=y help - This driver provides support for the built-in IDE controller on + This driver provides support for the on-board IDE controller on most of the recent Apple Power Macintoshes and PowerBooks. If unsure, say Y. config BLK_DEV_IDE_PMAC_ATA100FIRST - bool "Probe internal ATA/100 (Kauai) first" + bool "Probe on-board ATA/100 (Kauai) first" depends on BLK_DEV_IDE_PMAC help This option will cause the ATA/100 controller found in UniNorth2 @@ -823,7 +823,7 @@ config BLK_DEV_IDEDMA_PMAC depends on BLK_DEV_IDE_PMAC select BLK_DEV_IDEDMA_PCI help - This option allows the driver for the built-in IDE controller on + This option allows the driver for the on-board IDE controller on Power Macintoshes and PowerBooks to use DMA (direct memory access) to transfer data to and from memory. Saying Y is safe and improves performance. @@ -934,7 +934,7 @@ config BLK_DEV_GAYLE help This is the IDE driver for the Amiga Gayle IDE interface. It supports both the `A1200 style' and `A4000 style' of the Gayle IDE interface, - This includes builtin IDE interfaces on some Amiga models (A600, + This includes on-board IDE interfaces on some Amiga models (A600, A1200, A4000, and A4000T), and IDE interfaces on the Zorro expansion bus (M-Tech E-Matrix 530 expansion card). Say Y if you have an Amiga with a Gayle IDE interface and want to use @@ -948,10 +948,10 @@ config BLK_DEV_IDEDOUBLER depends on BLK_DEV_GAYLE && EXPERIMENTAL ---help--- This driver provides support for the so-called `IDE doublers' (made - by various manufacturers, e.g. Eyetech) that can be connected to the - builtin IDE interface of some Amiga models. Using such an IDE - doubler, you can connect up to four instead of two IDE devices on - the Amiga's builtin IDE interface. + by various manufacturers, e.g. Eyetech) that can be connected to + the on-board IDE interface of some Amiga models. Using such an IDE + doubler, you can connect up to four instead of two IDE devices to + the Amiga's on-board IDE interface. Note that the normal Amiga Gayle IDE driver may not work correctly if you have an IDE doubler and don't enable this driver! @@ -963,9 +963,9 @@ config BLK_DEV_BUDDHA tristate "Buddha/Catweasel/X-Surf IDE interface support (EXPERIMENTAL)" depends on ZORRO && EXPERIMENTAL help - This is the IDE driver for the IDE interfaces on the Buddha, - Catweasel and X-Surf expansion boards. It supports up to two interfaces - on the Buddha, three on the Catweasel and two on the X-Surf. + This is the IDE driver for the IDE interfaces on the Buddha, Catweasel + and X-Surf expansion boards. It supports up to two interfaces on the + Buddha, three on the Catweasel and two on the X-Surf. Say Y if you have a Buddha or Catweasel expansion board and want to use IDE devices (hard disks, CD-ROM drives, etc.) that are connected @@ -975,23 +975,23 @@ config BLK_DEV_FALCON_IDE tristate "Falcon IDE interface support" depends on ATARI help - This is the IDE driver for the builtin IDE interface on the Atari + This is the IDE driver for the on-board IDE interface on the Atari Falcon. Say Y if you have a Falcon and want to use IDE devices (hard - disks, CD-ROM drives, etc.) that are connected to the builtin IDE + disks, CD-ROM drives, etc.) that are connected to the on-board IDE interface. config BLK_DEV_MAC_IDE tristate "Macintosh Quadra/Powerbook IDE interface support" depends on MAC help - This is the IDE driver for the builtin IDE interface on some m68k + This is the IDE driver for the on-board IDE interface on some m68k Macintosh models. It supports both the `Quadra style' (used in Quadra/ Centris 630 and Performa 588 models) and `Powerbook style' (used in the Powerbook 150 and 190 models) IDE interface. Say Y if you have such an Macintosh model and want to use IDE devices (hard disks, CD-ROM drives, etc.) that are connected to the - builtin IDE interface. + on-board IDE interface. config BLK_DEV_Q40IDE tristate "Q40/Q60 IDE interface support" @@ -1062,8 +1062,8 @@ config BLK_DEV_ALI14XX boot parameter. It enables support for the secondary IDE interface of the ALI M1439/1443/1445/1487/1489 chipsets, and permits faster I/O speeds to be set as well. See the files - and for - more info. + and + for more info. config BLK_DEV_DTC2278 tristate "DTC-2278 support" @@ -1088,8 +1088,8 @@ config BLK_DEV_QD65XX help This driver is enabled at runtime using the "qd65xx.probe" kernel boot parameter. It permits faster I/O speeds to be set. See the - and for - more info. + and + for more info. config BLK_DEV_UMC8672 tristate "UMC-8672 support" -- cgit v1.2.3 From a4b5a4d91d6555df56489094cd5846cd03fc9239 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Fri, 1 Feb 2008 23:09:16 +0100 Subject: ide: unexport ide_dma_on ide_dma_on can be unexported. Signed-off-by: Adrian Bunk Cc: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-dma.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 5bf32038dc43..15f8c6abe429 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -474,8 +474,6 @@ void ide_dma_on(ide_drive_t *drive) drive->hwif->dma_host_set(drive, 1); } -EXPORT_SYMBOL(ide_dma_on); - #ifdef CONFIG_BLK_DEV_IDEDMA_PCI /** * ide_dma_setup - begin a DMA phase -- cgit v1.2.3 From 2eae6ebbf99a083687466c010e3129fede9cdb4b Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Fri, 1 Feb 2008 23:09:16 +0100 Subject: ide: small ide-scan-pci.c cleanup - ide_scan_pcibus() can become static - instead of ide_scan_pci() we can use ide_scan_pcibus() directly in module_init() Signed-off-by: Adrian Bunk Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-scan-pci.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-scan-pci.c b/drivers/ide/ide-scan-pci.c index 7ffa332d77ce..93d2e41be853 100644 --- a/drivers/ide/ide-scan-pci.c +++ b/drivers/ide/ide-scan-pci.c @@ -81,7 +81,7 @@ static int __init ide_scan_pcidev(struct pci_dev *dev) * module ordering not traditionally ordered. */ -int __init ide_scan_pcibus(void) +static int __init ide_scan_pcibus(void) { struct pci_dev *dev = NULL; struct pci_driver *d; @@ -113,9 +113,4 @@ int __init ide_scan_pcibus(void) return 0; } -static int __init ide_scan_pci(void) -{ - return ide_scan_pcibus(); -} - -module_init(ide_scan_pci); +module_init(ide_scan_pcibus); -- cgit v1.2.3 From da6f4c7f6fe02f92aff72071ed541f59e5880398 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Fri, 1 Feb 2008 23:09:16 +0100 Subject: ide: make wait_drive_not_busy() static again After commit 7267c3377443322588cddaf457cf106839a60463 wait_drive_not_busy() can become static again. Signed-off-by: Adrian Bunk Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-taskfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 5eb6fa15dc4d..d32000109124 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -260,7 +260,7 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive) return ide_stopped; } -u8 wait_drive_not_busy(ide_drive_t *drive) +static u8 wait_drive_not_busy(ide_drive_t *drive) { ide_hwif_t *hwif = HWIF(drive); int retries; -- cgit v1.2.3 From 468e468139ffbc4f0ce44862eec6dd0f5ac80945 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Fri, 1 Feb 2008 23:09:16 +0100 Subject: ide/ppc/pmac.c section fixes This patch fixes the following section mismatch: <-- snip --> ... WARNING: vmlinux.o(.text+0x3b641c): Section mismatch in reference from the function .pmac_ide_setup_device() to the function .init.text:.pmac_ide_setup_dma() ... <-- snip --> Signed-off-by: Adrian Bunk Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ppc/pmac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 736d12c8e68a..4afc58fb3674 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -1011,7 +1011,7 @@ pmac_ide_do_resume(ide_hwif_t *hwif) * (it is kept in 2.4). This introduce an interface numbering change on some * rare machines unfortunately, but it's better this way. */ -static int +static int __devinit pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) { struct device_node *np = pmif->node; @@ -1726,7 +1726,7 @@ pmac_ide_dma_lost_irq (ide_drive_t *drive) * Allocate the data structures needed for using DMA with an interface * and fill the proper list of functions pointers */ -static void __init +static void __devinit pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) { /* We won't need pci_dev if we switch to generic consistent -- cgit v1.2.3 From 68661c53a2a847b9a0d6d232a85b2e063573307a Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:17 +0100 Subject: ide-cd: use xfer_func_t in cdrom_pc_intr() Unify writing and reading handling in cdrom_pc_intr() using xfer_func_t. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.c | 47 +++++++++++++++++------------------------------ 1 file changed, 17 insertions(+), 30 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index bee05a3f52ae..f2b951dd1421 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -1005,6 +1005,8 @@ static ide_startstop_t cdrom_transfer_packet_command (ide_drive_t *drive, * Block read functions. */ +typedef void (xfer_func_t)(ide_drive_t *, void *, u32); + /* * Buffer up to SECTORS_TO_TRANSFER sectors from the drive in our sector * buffer. Once the first sector is added, any subsequent sectors are @@ -1430,10 +1432,10 @@ static ide_startstop_t cdrom_start_read (ide_drive_t *drive, unsigned int block) /* Interrupt routine for packet command completion. */ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive) { - int ireason, len, thislen; struct request *rq = HWGROUP(drive)->rq; + xfer_func_t *xferfunc = NULL; + int stat, ireason, len, thislen, write; u8 lowcyl = 0, highcyl = 0; - int stat; /* Check for errors. */ if (cdrom_decode_status(drive, 0, &stat)) @@ -1478,44 +1480,31 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive) /* Figure out how much data to transfer. */ thislen = rq->data_len; - if (thislen > len) thislen = len; + if (thislen > len) + thislen = len; - /* The drive wants to be written to. */ if (ireason == 0) { - if (!rq->data) { - blk_dump_rq_flags(rq, "cdrom_pc_intr, write"); - goto confused; - } - /* Transfer the data. */ - HWIF(drive)->atapi_output_bytes(drive, rq->data, thislen); - - /* If we haven't moved enough data to satisfy the drive, - add some padding. */ - while (len > thislen) { - int dum = 0; - HWIF(drive)->atapi_output_bytes(drive, &dum, sizeof(dum)); - len -= sizeof(dum); - } - - /* Keep count of how much data we've moved. */ - rq->data += thislen; - rq->data_len -= thislen; + write = 1; + xferfunc = HWIF(drive)->atapi_output_bytes; + } else if (ireason == 2) { + write = 0; + xferfunc = HWIF(drive)->atapi_input_bytes; } - /* Same drill for reading. */ - else if (ireason == 2) { + if (xferfunc) { if (!rq->data) { - blk_dump_rq_flags(rq, "cdrom_pc_intr, read"); + blk_dump_rq_flags(rq, write ? "cdrom_pc_intr, write" + : "cdrom_pc_intr, read"); goto confused; } /* Transfer the data. */ - HWIF(drive)->atapi_input_bytes(drive, rq->data, thislen); + xferfunc(drive, rq->data, thislen); /* If we haven't moved enough data to satisfy the drive, add some padding. */ while (len > thislen) { int dum = 0; - HWIF(drive)->atapi_input_bytes(drive, &dum, sizeof(dum)); + xferfunc(drive, &dum, sizeof(dum)); len -= sizeof(dum); } @@ -1523,7 +1512,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive) rq->data += thislen; rq->data_len -= thislen; - if (blk_sense_request(rq)) + if (write && blk_sense_request(rq)) rq->sense_len += thislen; } else { confused: @@ -1658,8 +1647,6 @@ static int cdrom_newpc_intr_dummy_cb(struct request *rq) return 1; } -typedef void (xfer_func_t)(ide_drive_t *, void *, u32); - /* * best way to deal with dma that is not sector aligned right now... note * that in this path we are not using ->data or ->buffer at all. this irs -- cgit v1.2.3 From 5a5222d9fa4aa7ae3b1d5c126cb9c83124d75af5 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:17 +0100 Subject: ide-cd: add ide_cd_pad_transfer() helper Add ide_cd_pad_transfer() helper and use it in cdrom_[new]pc_intr() and cdrom_{read,write}_check_ireason(). There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.c | 51 +++++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index f2b951dd1421..75539fd0829c 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -1007,6 +1007,15 @@ static ide_startstop_t cdrom_transfer_packet_command (ide_drive_t *drive, typedef void (xfer_func_t)(ide_drive_t *, void *, u32); +static void ide_cd_pad_transfer(ide_drive_t *drive, xfer_func_t *xf, int len) +{ + while (len > 0) { + int dum = 0; + xf(drive, &dum, sizeof(dum)); + len -= sizeof(dum); + } +} + /* * Buffer up to SECTORS_TO_TRANSFER sectors from the drive in our sector * buffer. Once the first sector is added, any subsequent sectors are @@ -1063,17 +1072,15 @@ int cdrom_read_check_ireason (ide_drive_t *drive, int len, int ireason) if (ireason == 2) return 0; else if (ireason == 0) { + ide_hwif_t *hwif = drive->hwif; + /* Whoops... The drive is expecting to receive data from us! */ printk(KERN_ERR "%s: %s: wrong transfer direction!\n", drive->name, __FUNCTION__); /* Throw some data at the drive so it doesn't hang and quit this request. */ - while (len > 0) { - int dum = 0; - HWIF(drive)->atapi_output_bytes(drive, &dum, sizeof (dum)); - len -= sizeof (dum); - } + ide_cd_pad_transfer(drive, hwif->atapi_output_bytes, len); } else if (ireason == 1) { /* Some drives (ASUS) seem to tell us that status * info is available. just get it and ignore. @@ -1500,15 +1507,8 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive) /* Transfer the data. */ xferfunc(drive, rq->data, thislen); - /* If we haven't moved enough data to satisfy the drive, - add some padding. */ - while (len > thislen) { - int dum = 0; - xferfunc(drive, &dum, sizeof(dum)); - len -= sizeof(dum); - } - /* Keep count of how much data we've moved. */ + len -= thislen; rq->data += thislen; rq->data_len -= thislen; @@ -1525,6 +1525,13 @@ confused: return ide_stopped; } + /* + * If we haven't moved enough data to satisfy the drive, + * add some padding. + */ + if (len > 0) + ide_cd_pad_transfer(drive, xferfunc, len); + /* Now we wait for another interrupt. */ ide_set_handler(drive, &cdrom_pc_intr, ATAPI_WAIT_PC, cdrom_timer_expiry); return ide_started; @@ -1617,15 +1624,13 @@ static int cdrom_write_check_ireason(ide_drive_t *drive, int len, int ireason) if (ireason == 0) return 0; else if (ireason == 2) { + ide_hwif_t *hwif = drive->hwif; + /* Whoops... The drive wants to send data. */ printk(KERN_ERR "%s: %s: wrong transfer direction!\n", drive->name, __FUNCTION__); - while (len > 0) { - int dum = 0; - HWIF(drive)->atapi_input_bytes(drive, &dum, sizeof(dum)); - len -= sizeof(dum); - } + ide_cd_pad_transfer(drive, hwif->atapi_input_bytes, len); } else { /* Drive wants a command packet, or invalid ireason... */ printk(KERN_ERR "%s: %s: bad interrupt reason 0x%02x\n", @@ -1783,14 +1788,8 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) /* * pad, if necessary */ - if (len > 0) { - while (len > 0) { - int pad = 0; - - xferfunc(drive, &pad, sizeof(pad)); - len -= sizeof(pad); - } - } + if (len > 0) + ide_cd_pad_transfer(drive, xferfunc, len); BUG_ON(HWGROUP(drive)->handler != NULL); -- cgit v1.2.3 From f1071e628bc769174c3e2df7827a2a8ad05aea67 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:17 +0100 Subject: ide-cd: fix "missing data" handling in cdrom_pc_intr() If drive still wants to transfer the data we need to pad the transfer instead of just finishing the request. Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 75539fd0829c..cbe4f1a04c14 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -1500,9 +1500,11 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive) if (xferfunc) { if (!rq->data) { + printk(KERN_ERR "%s: confused, missing data\n", + drive->name); blk_dump_rq_flags(rq, write ? "cdrom_pc_intr, write" : "cdrom_pc_intr, read"); - goto confused; + goto pad; } /* Transfer the data. */ xferfunc(drive, rq->data, thislen); @@ -1515,7 +1517,6 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive) if (write && blk_sense_request(rq)) rq->sense_len += thislen; } else { -confused: printk (KERN_ERR "%s: cdrom_pc_intr: The drive " "appears confused (ireason = 0x%02x). " "Trying to recover by ending request.\n", @@ -1524,7 +1525,7 @@ confused: cdrom_end_request(drive, 0); return ide_stopped; } - +pad: /* * If we haven't moved enough data to satisfy the drive, * add some padding. -- cgit v1.2.3 From eba15fba1f046d25c663d294fc919ab59cec3e9c Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:17 +0100 Subject: ide-cd: fix DMA error handling in cdrom_newpc_intr() Make cdrom_newpc_intr() match cdrom_{read,write}_intr() w.r.t. handling DMA errors: * disable DMA before cdrom_decode_status() call * log the device name and the type of the request (read/write) Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index cbe4f1a04c14..c638d057f910 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -1674,6 +1674,11 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) if (dma) { info->dma = 0; dma_error = HWIF(drive)->ide_dma_end(drive); + if (dma_error) { + printk(KERN_ERR "%s: DMA %s error\n", drive->name, + rq_data_dir(rq) ? "write" : "read"); + ide_dma_off(drive); + } } if (cdrom_decode_status(drive, 0, &stat)) @@ -1683,11 +1688,8 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) * using dma, transfer is complete now */ if (dma) { - if (dma_error) { - printk(KERN_ERR "ide-cd: dma error\n"); - ide_dma_off(drive); + if (dma_error) return ide_error(drive, "dma error", stat); - } spin_lock_irqsave(&ide_lock, flags); if (__blk_end_request(rq, 0, rq->data_len)) -- cgit v1.2.3 From cc6dbef25273f032d2b580bd0519ea950cb7cb83 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:18 +0100 Subject: ide-cd: fix trailing whitespaces in changelog Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index c638d057f910..591768c8ba0b 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -129,16 +129,15 @@ * 3.14 May 29, 1996 -- Add work-around for Vertos 600. * (From Hennus Bergman .) * 3.15 July 2, 1996 -- Added support for Sanyo 3 CD changers - * from Ben Galliart with - * special help from Jeff Lightfoot + * from Ben Galliart with + * special help from Jeff Lightfoot * * 3.15a July 9, 1996 -- Improved Sanyo 3 CD changer identification * 3.16 Jul 28, 1996 -- Fix from Gadi to reduce kernel stack usage for ioctl. * 3.17 Sep 17, 1996 -- Tweak audio reads for some drives. * Start changing CDROMLOADFROMSLOT to CDROM_SELECT_DISC. * 3.18 Oct 31, 1996 -- Added module and DMA support. - * - * + * * 4.00 Nov 5, 1996 -- New ide-cd maintainer, * Erik B. Andersen * -- Newer Creative drives don't always set the error @@ -153,8 +152,8 @@ * -- Add some probes of drive capability during setup. * * 4.01 Nov 11, 1996 -- Split into ide-cd.c and ide-cd.h - * -- Removed CDROMMECHANISMSTATUS and CDROMSLOTTABLE - * ioctls in favor of a generalized approach + * -- Removed CDROMMECHANISMSTATUS and CDROMSLOTTABLE + * ioctls in favor of a generalized approach * using the generic cdrom driver. * -- Fully integrated with the 2.1.X kernel. * -- Other stuff that I forgot (lots of changes) @@ -163,7 +162,7 @@ * to fix the drive door locking problems. * * 4.03 Dec 04, 1996 -- Added DSC overlap support. - * 4.04 Dec 29, 1996 -- Added CDROMREADRAW ioclt based on patch + * 4.04 Dec 29, 1996 -- Added CDROMREADRAW ioclt based on patch * by Ales Makarov (xmakarov@sun.felk.cvut.cz) * * 4.05 Nov 20, 1997 -- Modified to print more drive info on init @@ -186,7 +185,7 @@ * -- Cleaned up the global namespace a bit by making more * functions static that should already have been. * 4.11 Mar 12, 1998 -- Added support for the CDROM_SELECT_SPEED ioctl - * based on a patch for 2.0.33 by Jelle Foks + * based on a patch for 2.0.33 by Jelle Foks * , a patch for 2.0.33 * by Toni Giorgino , the SCSI * version, and my own efforts. -erik @@ -194,8 +193,8 @@ * inform me of where "Illegal mode for this track" * was never returned due to a comparison on data * types of limited range. - * 4.12 Mar 29, 1998 -- Fixed bug in CDROM_SELECT_SPEED so write speed is - * now set ionly for CD-R and CD-RW drives. I had + * 4.12 Mar 29, 1998 -- Fixed bug in CDROM_SELECT_SPEED so write speed is + * now set ionly for CD-R and CD-RW drives. I had * removed this support because it produced errors. * It produced errors _only_ for non-writers. duh. * 4.13 May 05, 1998 -- Suppress useless "in progress of becoming ready" @@ -206,7 +205,7 @@ * since the .pdf version doesn't seem to work... * -- Updated the TODO list to something more current. * - * 4.15 Aug 25, 1998 -- Updated ide-cd.h to respect mechine endianess, + * 4.15 Aug 25, 1998 -- Updated ide-cd.h to respect mechine endianess, * patch thanks to "Eddie C. Dost" * * 4.50 Oct 19, 1998 -- New maintainers! @@ -270,7 +269,7 @@ * - Mode sense and mode select moved to the * Uniform layer. * - Fixed a problem with WPI CDS-32X drive - it - * failed the capabilities + * failed the capabilities * * 4.57 Apr 7, 2000 - Fixed sense reporting. * - Fixed possible oops in ide_cdrom_get_last_session() -- cgit v1.2.3 From 03553353e91121dbe57f4a6d40b731374ff7438a Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:18 +0100 Subject: ide-cd: move historical changelog to Documentation/ide/ChangeLog.ide-cd.1994-2004 Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.c | 274 +-------------------------------------------------- 1 file changed, 4 insertions(+), 270 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 591768c8ba0b..945d730617c8 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -28,276 +28,10 @@ * -Make it so that Pioneer CD DR-A24X and friends don't get screwed up on * boot * - * ---------------------------------- - * 1.00 Oct 31, 1994 -- Initial version. - * 1.01 Nov 2, 1994 -- Fixed problem with starting request in - * cdrom_check_status. - * 1.03 Nov 25, 1994 -- leaving unmask_intr[] as a user-setting (as for disks) - * (from mlord) -- minor changes to cdrom_setup() - * -- renamed ide_dev_s to ide_drive_t, enable irq on command - * 2.00 Nov 27, 1994 -- Generalize packet command interface; - * add audio ioctls. - * 2.01 Dec 3, 1994 -- Rework packet command interface to handle devices - * which send an interrupt when ready for a command. - * 2.02 Dec 11, 1994 -- Cache the TOC in the driver. - * Don't use SCMD_PLAYAUDIO_TI; it's not included - * in the current version of ATAPI. - * Try to use LBA instead of track or MSF addressing - * when possible. - * Don't wait for READY_STAT. - * 2.03 Jan 10, 1995 -- Rewrite block read routines to handle block sizes - * other than 2k and to move multiple sectors in a - * single transaction. - * 2.04 Apr 21, 1995 -- Add work-around for Creative Labs CD220E drives. - * Thanks to Nick Saw for - * help in figuring this out. Ditto for Acer and - * Aztech drives, which seem to have the same problem. - * 2.04b May 30, 1995 -- Fix to match changes in ide.c version 3.16 -ml - * 2.05 Jun 8, 1995 -- Don't attempt to retry after an illegal request - * or data protect error. - * Use HWIF and DEV_HWIF macros as in ide.c. - * Always try to do a request_sense after - * a failed command. - * Include an option to give textual descriptions - * of ATAPI errors. - * Fix a bug in handling the sector cache which - * showed up if the drive returned data in 512 byte - * blocks (like Pioneer drives). Thanks to - * Richard Hirst for diagnosing this. - * Properly supply the page number field in the - * MODE_SELECT command. - * PLAYAUDIO12 is broken on the Aztech; work around it. - * 2.05x Aug 11, 1995 -- lots of data structure renaming/restructuring in ide.c - * (my apologies to Scott, but now ide-cd.c is independent) - * 3.00 Aug 22, 1995 -- Implement CDROMMULTISESSION ioctl. - * Implement CDROMREADAUDIO ioctl (UNTESTED). - * Use input_ide_data() and output_ide_data(). - * Add door locking. - * Fix usage count leak in cdrom_open, which happened - * when a read-write mount was attempted. - * Try to load the disk on open. - * Implement CDROMEJECT_SW ioctl (off by default). - * Read total cdrom capacity during open. - * Rearrange logic in cdrom_decode_status. Issue - * request sense commands for failed packet commands - * from here instead of from cdrom_queue_packet_command. - * Fix a race condition in retrieving error information. - * Suppress printing normal unit attention errors and - * some drive not ready errors. - * Implement CDROMVOLREAD ioctl. - * Implement CDROMREADMODE1/2 ioctls. - * Fix race condition in setting up interrupt handlers - * when the `serialize' option is used. - * 3.01 Sep 2, 1995 -- Fix ordering of reenabling interrupts in - * cdrom_queue_request. - * Another try at using ide_[input,output]_data. - * 3.02 Sep 16, 1995 -- Stick total disk capacity in partition table as well. - * Make VERBOSE_IDE_CD_ERRORS dump failed command again. - * Dump out more information for ILLEGAL REQUEST errs. - * Fix handling of errors occurring before the - * packet command is transferred. - * Fix transfers with odd bytelengths. - * 3.03 Oct 27, 1995 -- Some Creative drives have an id of just `CD'. - * `DCI-2S10' drives are broken too. - * 3.04 Nov 20, 1995 -- So are Vertos drives. - * 3.05 Dec 1, 1995 -- Changes to go with overhaul of ide.c and ide-tape.c - * 3.06 Dec 16, 1995 -- Add support needed for partitions. - * More workarounds for Vertos bugs (based on patches - * from Holger Dietze ). - * Try to eliminate byteorder assumptions. - * Use atapi_cdrom_subchnl struct definition. - * Add STANDARD_ATAPI compilation option. - * 3.07 Jan 29, 1996 -- More twiddling for broken drives: Sony 55D, - * Vertos 300. - * Add NO_DOOR_LOCKING configuration option. - * Handle drive_cmd requests w/NULL args (for hdparm -t). - * Work around sporadic Sony55e audio play problem. - * 3.07a Feb 11, 1996 -- check drive->id for NULL before dereferencing, to fix - * problem with "hde=cdrom" with no drive present. -ml - * 3.08 Mar 6, 1996 -- More Vertos workarounds. - * 3.09 Apr 5, 1996 -- Add CDROMCLOSETRAY ioctl. - * Switch to using MSF addressing for audio commands. - * Reformat to match kernel tabbing style. - * Add CDROM_GET_UPC ioctl. - * 3.10 Apr 10, 1996 -- Fix compilation error with STANDARD_ATAPI. - * 3.11 Apr 29, 1996 -- Patch from Heiko Eißfeldt - * to remove redundant verify_area calls. - * 3.12 May 7, 1996 -- Rudimentary changer support. Based on patches - * from Gerhard Zuber . - * Let open succeed even if there's no loaded disc. - * 3.13 May 19, 1996 -- Fixes for changer code. - * 3.14 May 29, 1996 -- Add work-around for Vertos 600. - * (From Hennus Bergman .) - * 3.15 July 2, 1996 -- Added support for Sanyo 3 CD changers - * from Ben Galliart with - * special help from Jeff Lightfoot - * - * 3.15a July 9, 1996 -- Improved Sanyo 3 CD changer identification - * 3.16 Jul 28, 1996 -- Fix from Gadi to reduce kernel stack usage for ioctl. - * 3.17 Sep 17, 1996 -- Tweak audio reads for some drives. - * Start changing CDROMLOADFROMSLOT to CDROM_SELECT_DISC. - * 3.18 Oct 31, 1996 -- Added module and DMA support. - * - * 4.00 Nov 5, 1996 -- New ide-cd maintainer, - * Erik B. Andersen - * -- Newer Creative drives don't always set the error - * register correctly. Make sure we see media changes - * regardless. - * -- Integrate with generic cdrom driver. - * -- CDROMGETSPINDOWN and CDROMSETSPINDOWN ioctls, based on - * a patch from Ciro Cattuto <>. - * -- Call set_device_ro. - * -- Implement CDROMMECHANISMSTATUS and CDROMSLOTTABLE - * ioctls, based on patch by Erik Andersen - * -- Add some probes of drive capability during setup. - * - * 4.01 Nov 11, 1996 -- Split into ide-cd.c and ide-cd.h - * -- Removed CDROMMECHANISMSTATUS and CDROMSLOTTABLE - * ioctls in favor of a generalized approach - * using the generic cdrom driver. - * -- Fully integrated with the 2.1.X kernel. - * -- Other stuff that I forgot (lots of changes) - * - * 4.02 Dec 01, 1996 -- Applied patch from Gadi Oxman - * to fix the drive door locking problems. - * - * 4.03 Dec 04, 1996 -- Added DSC overlap support. - * 4.04 Dec 29, 1996 -- Added CDROMREADRAW ioclt based on patch - * by Ales Makarov (xmakarov@sun.felk.cvut.cz) - * - * 4.05 Nov 20, 1997 -- Modified to print more drive info on init - * Minor other changes - * Fix errors on CDROMSTOP (If you have a "Dolphin", - * you must define IHAVEADOLPHIN) - * Added identifier so new Sanyo CD-changer works - * Better detection if door locking isn't supported - * - * 4.06 Dec 17, 1997 -- fixed endless "tray open" messages -ml - * 4.07 Dec 17, 1997 -- fallback to set pc->stat on "tray open" - * 4.08 Dec 18, 1997 -- spew less noise when tray is empty - * -- fix speed display for ACER 24X, 18X - * 4.09 Jan 04, 1998 -- fix handling of the last block so we return - * an end of file instead of an I/O error (Gadi) - * 4.10 Jan 24, 1998 -- fixed a bug so now changers can change to a new - * slot when there is no disc in the current slot. - * -- Fixed a memory leak where info->changer_info was - * malloc'ed but never free'd when closing the device. - * -- Cleaned up the global namespace a bit by making more - * functions static that should already have been. - * 4.11 Mar 12, 1998 -- Added support for the CDROM_SELECT_SPEED ioctl - * based on a patch for 2.0.33 by Jelle Foks - * , a patch for 2.0.33 - * by Toni Giorgino , the SCSI - * version, and my own efforts. -erik - * -- Fixed a stupid bug which egcs was kind enough to - * inform me of where "Illegal mode for this track" - * was never returned due to a comparison on data - * types of limited range. - * 4.12 Mar 29, 1998 -- Fixed bug in CDROM_SELECT_SPEED so write speed is - * now set ionly for CD-R and CD-RW drives. I had - * removed this support because it produced errors. - * It produced errors _only_ for non-writers. duh. - * 4.13 May 05, 1998 -- Suppress useless "in progress of becoming ready" - * messages, since this is not an error. - * -- Change error messages to be const - * -- Remove a "\t" which looks ugly in the syslogs - * 4.14 July 17, 1998 -- Change to pointing to .ps version of ATAPI spec - * since the .pdf version doesn't seem to work... - * -- Updated the TODO list to something more current. - * - * 4.15 Aug 25, 1998 -- Updated ide-cd.h to respect mechine endianess, - * patch thanks to "Eddie C. Dost" - * - * 4.50 Oct 19, 1998 -- New maintainers! - * Jens Axboe - * Chris Zwilling - * - * 4.51 Dec 23, 1998 -- Jens Axboe - * - ide_cdrom_reset enabled since the ide subsystem - * handles resets fine now. - * - Transfer size fix for Samsung CD-ROMs, thanks to - * "Ville Hallik" . - * - other minor stuff. - * - * 4.52 Jan 19, 1999 -- Jens Axboe - * - Detect DVD-ROM/RAM drives - * - * 4.53 Feb 22, 1999 - Include other model Samsung and one Goldstar - * drive in transfer size limit. - * - Fix the I/O error when doing eject without a medium - * loaded on some drives. - * - CDROMREADMODE2 is now implemented through - * CDROMREADRAW, since many drives don't support - * MODE2 (even though ATAPI 2.6 says they must). - * - Added ignore parameter to ide-cd (as a module), eg - * insmod ide-cd ignore='hda hdb' - * Useful when using ide-cd in conjunction with - * ide-scsi. TODO: non-modular way of doing the - * same. - * - * 4.54 Aug 5, 1999 - Support for MMC2 class commands through the generic - * packet interface to cdrom.c. - * - Unified audio ioctl support, most of it. - * - cleaned up various deprecated verify_area(). - * - Added ide_cdrom_packet() as the interface for - * the Uniform generic_packet(). - * - bunch of other stuff, will fill in logs later. - * - report 1 slot for non-changers, like the other - * cd-rom drivers. don't report select disc for - * non-changers as well. - * - mask out audio playing, if the device can't do it. - * - * 4.55 Sep 1, 1999 - Eliminated the rest of the audio ioctls, except - * for CDROMREADTOC[ENTRY|HEADER]. Some of the drivers - * use this independently of the actual audio handling. - * They will disappear later when I get the time to - * do it cleanly. - * - Minimize the TOC reading - only do it when we - * know a media change has occurred. - * - Moved all the CDROMREADx ioctls to the Uniform layer. - * - Heiko Eißfeldt supplied - * some fixes for CDI. - * - CD-ROM leaving door locked fix from Andries - * Brouwer - * - Erik Andersen unified - * commands across the various drivers and how - * sense errors are handled. - * - * 4.56 Sep 12, 1999 - Removed changer support - it is now in the - * Uniform layer. - * - Added partition based multisession handling. - * - Mode sense and mode select moved to the - * Uniform layer. - * - Fixed a problem with WPI CDS-32X drive - it - * failed the capabilities - * - * 4.57 Apr 7, 2000 - Fixed sense reporting. - * - Fixed possible oops in ide_cdrom_get_last_session() - * - Fix locking mania and make ide_cdrom_reset relock - * - Stop spewing errors to log when magicdev polls with - * TEST_UNIT_READY on some drives. - * - Various fixes from Tobias Ringstrom: - * tray if it was locked prior to the reset. - * - cdrom_read_capacity returns one frame too little. - * - Fix real capacity reporting. - * - * 4.58 May 1, 2000 - Clean up ACER50 stuff. - * - Fix small problem with ide_cdrom_capacity - * - * 4.59 Aug 11, 2000 - Fix changer problem in cdrom_read_toc, we weren't - * correctly sensing a disc change. - * - Rearranged some code - * - Use extended sense on drives that support it for - * correctly reporting tray status -- from - * Michael D Johnson - * 4.60 Dec 17, 2003 - Add mt rainier support - * - Bump timeout for packet commands, matches sr - * - Odd stuff - * 4.61 Jan 22, 2004 - support hardware sector sizes other than 2kB, - * Pascal Schmidt - * - *************************************************************************/ - + * For historical changelog please see: + * Documentation/ide/ChangeLog.ide-cd.1994-2004 + */ + #define IDECD_VERSION "4.61" #include -- cgit v1.2.3 From 4415e871d6d497f0a90332c4b3a488ebccbf217d Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:18 +0100 Subject: ide-cd: remove stale cdrom_transfer_packet_command() comment Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 945d730617c8..8dea991ccee7 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -684,10 +684,6 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive, by cdrom_start_packet_command. HANDLER is the interrupt handler to call when the command completes or there's data ready. */ -/* - * changed 5 parameters to 3 for dvd-ram - * struct packet_command *pc; now packet_command_t *pc; - */ #define ATAPI_MIN_CDB_BYTES 12 static ide_startstop_t cdrom_transfer_packet_command (ide_drive_t *drive, struct request *rq, -- cgit v1.2.3 From 9f8256dbb690eeb93a8b2422ff02382e3a19ed20 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:18 +0100 Subject: ide-cd: remove unused defines from ide-cd.h Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.h | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h index 1b302fe2724d..1e138c9278de 100644 --- a/drivers/ide/ide-cd.h +++ b/drivers/ide/ide-cd.h @@ -49,16 +49,6 @@ #endif #define SECTORS_PER_FRAME (CD_FRAMESIZE >> SECTOR_BITS) #define SECTOR_BUFFER_SIZE (CD_FRAMESIZE * 32) -#define SECTORS_BUFFER (SECTOR_BUFFER_SIZE >> SECTOR_BITS) -#define SECTORS_MAX (131072 >> SECTOR_BITS) - -#define BLOCKS_PER_FRAME (CD_FRAMESIZE / BLOCK_SIZE) - -/* special command codes for strategy routine. */ -#define PACKET_COMMAND 4315 -#define REQUEST_SENSE_COMMAND 4316 -#define RESET_DRIVE_COMMAND 4317 - /* Configuration flags. These describe the capabilities of the drive. They generally do not change after initialization, unless we learn -- cgit v1.2.3 From 6229ac1ff32692694b7b0e74585b1ef6fa8973fd Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:18 +0100 Subject: ide-cd: remove dead code from cdrom_pc_intr() Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 8dea991ccee7..bec6ac077b4d 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -1201,13 +1201,6 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive) if (rq->data_len == 0) cdrom_end_request(drive, 1); else { - /* Comment this out, because this always happens - right after a reset occurs, and it is annoying to - always print expected stuff. */ - /* - printk ("%s: cdrom_pc_intr: data underrun %d\n", - drive->name, pc->buflen); - */ rq->cmd_flags |= REQ_FAILED; cdrom_end_request(drive, 0); } -- cgit v1.2.3 From f17b0e02c0035b90c4e943f6e2cca840f82dce0f Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:19 +0100 Subject: ide-cd: remove unused struct atapi_cdrom_subchnl Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.h | 32 -------------------------------- 1 file changed, 32 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h index 1e138c9278de..e6f219772549 100644 --- a/drivers/ide/ide-cd.h +++ b/drivers/ide/ide-cd.h @@ -145,38 +145,6 @@ struct atapi_toc { /* One extra for the leadout. */ }; - -/* This structure is annoyingly close to, but not identical with, - the cdrom_subchnl structure from cdrom.h. */ -struct atapi_cdrom_subchnl { - u_char acdsc_reserved; - u_char acdsc_audiostatus; - u_short acdsc_length; - u_char acdsc_format; - -#if defined(__BIG_ENDIAN_BITFIELD) - u_char acdsc_ctrl: 4; - u_char acdsc_adr: 4; -#elif defined(__LITTLE_ENDIAN_BITFIELD) - u_char acdsc_adr: 4; - u_char acdsc_ctrl: 4; -#else -#error "Please fix " -#endif - u_char acdsc_trk; - u_char acdsc_ind; - union { - struct atapi_msf msf; - int lba; - } acdsc_absaddr; - union { - struct atapi_msf msf; - int lba; - } acdsc_reladdr; -}; - - - /* This should probably go into cdrom.h along with the other * generic stuff now in the Mt. Fuji spec. */ -- cgit v1.2.3 From b8d25dee3b73b572ea1778671098ee7b943133c5 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:19 +0100 Subject: ide-cd: remove needless zeroing of 'info' fields from ide_cdrom_setup() ide_cd_probe() zeroes 'info' prior to calling ide_cdrom_setup() so there is no need to explicitly zero 'info' fields in the latter function. Ditto for fields of CDROM_STATE_FLAGS(), CDROM_CONFIG_FLAGS() and 'cdi' (all are embedded in 'info'). Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.c | 44 +++++++------------------------------------- 1 file changed, 7 insertions(+), 37 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index bec6ac077b4d..cd3ea32041bb 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -2865,30 +2865,16 @@ int ide_cdrom_setup (ide_drive_t *drive) drive->special.all = 0; CDROM_STATE_FLAGS(drive)->media_changed = 1; - CDROM_STATE_FLAGS(drive)->toc_valid = 0; - CDROM_STATE_FLAGS(drive)->door_locked = 0; #if NO_DOOR_LOCKING CDROM_CONFIG_FLAGS(drive)->no_doorlock = 1; -#else - CDROM_CONFIG_FLAGS(drive)->no_doorlock = 0; #endif - - CDROM_CONFIG_FLAGS(drive)->drq_interrupt = ((drive->id->config & 0x0060) == 0x20); - CDROM_CONFIG_FLAGS(drive)->is_changer = 0; - CDROM_CONFIG_FLAGS(drive)->cd_r = 0; - CDROM_CONFIG_FLAGS(drive)->cd_rw = 0; - CDROM_CONFIG_FLAGS(drive)->test_write = 0; - CDROM_CONFIG_FLAGS(drive)->dvd = 0; - CDROM_CONFIG_FLAGS(drive)->dvd_r = 0; - CDROM_CONFIG_FLAGS(drive)->dvd_ram = 0; + if ((drive->id->config & 0x0060) == 0x20) + CDROM_CONFIG_FLAGS(drive)->drq_interrupt = 1; CDROM_CONFIG_FLAGS(drive)->no_eject = 1; - CDROM_CONFIG_FLAGS(drive)->supp_disc_present = 0; - CDROM_CONFIG_FLAGS(drive)->audio_play = 0; CDROM_CONFIG_FLAGS(drive)->close_tray = 1; - + /* limit transfer size per interrupt. */ - CDROM_CONFIG_FLAGS(drive)->limit_nframes = 0; /* a testament to the nice quality of Samsung drives... */ if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-2430")) CDROM_CONFIG_FLAGS(drive)->limit_nframes = 1; @@ -2899,16 +2885,6 @@ int ide_cdrom_setup (ide_drive_t *drive) CDROM_CONFIG_FLAGS(drive)->no_speed_select = 1; #if ! STANDARD_ATAPI - /* by default Sanyo 3 CD changer support is turned off and - ATAPI Rev 2.2+ standard support for CD changers is used */ - cdi->sanyo_slot = 0; - - CDROM_CONFIG_FLAGS(drive)->nec260 = 0; - CDROM_CONFIG_FLAGS(drive)->toctracks_as_bcd = 0; - CDROM_CONFIG_FLAGS(drive)->tocaddr_as_bcd = 0; - CDROM_CONFIG_FLAGS(drive)->playmsf_as_bcd = 0; - CDROM_CONFIG_FLAGS(drive)->subchan_as_bcd = 0; - if (strcmp (drive->id->model, "V003S0DS") == 0 && drive->id->fw_rev[4] == '1' && drive->id->fw_rev[6] <= '2') { @@ -2942,8 +2918,10 @@ int ide_cdrom_setup (ide_drive_t *drive) CDROM_CONFIG_FLAGS(drive)->playmsf_as_bcd = 1; CDROM_CONFIG_FLAGS(drive)->subchan_as_bcd = 1; } - /* Sanyo 3 CD changer uses a non-standard command - for CD changing */ + /* + * Sanyo 3 CD changer uses a non-standard command for CD changing + * (by default standard ATAPI support for CD changers is used). + */ else if ((strcmp(drive->id->model, "CD-ROM CDR-C3 G") == 0) || (strcmp(drive->id->model, "CD-ROM CDR-C3G") == 0) || (strcmp(drive->id->model, "CD-ROM CDR_C36") == 0)) { @@ -2952,14 +2930,6 @@ int ide_cdrom_setup (ide_drive_t *drive) } #endif /* not STANDARD_ATAPI */ - info->toc = NULL; - info->buffer = NULL; - info->sector_buffered = 0; - info->nsectors_buffered = 0; - info->changer_info = NULL; - info->last_block = 0; - info->start_seek = 0; - nslots = ide_cdrom_probe_capabilities (drive); /* -- cgit v1.2.3 From 2609d06d36317cc22f6d3c37186a8cf1a5f87ba6 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:19 +0100 Subject: ide-cd: remove unused and write-only struct ide_cd_config_flags fields unused fields: * ->writing * ->reserved write-only fields: * ->playmsf_as_bcd * ->subchan_as_bcd * ->test_write * ->supp_disc_present Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.c | 18 ++---------------- drivers/ide/ide-cd.h | 7 ------- 2 files changed, 2 insertions(+), 23 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index cd3ea32041bb..c736f769bff3 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -2693,8 +2693,6 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive) CDROM_CONFIG_FLAGS(drive)->cd_rw = 1; CDROM_CONFIG_FLAGS(drive)->ram = 1; } - if (cap.test_write) - CDROM_CONFIG_FLAGS(drive)->test_write = 1; if (cap.dvd_ram_read || cap.dvd_r_read || cap.dvd_rom) CDROM_CONFIG_FLAGS(drive)->dvd = 1; if (cap.dvd_ram_write) { @@ -2727,10 +2725,9 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive) #endif /* not STANDARD_ATAPI */ if (cap.mechtype == mechtype_individual_changer || cap.mechtype == mechtype_cartridge_changer) { - if ((nslots = cdrom_number_of_slots(cdi)) > 1) { + nslots = cdrom_number_of_slots(cdi); + if (nslots > 1) CDROM_CONFIG_FLAGS(drive)->is_changer = 1; - CDROM_CONFIG_FLAGS(drive)->supp_disc_present = 1; - } } ide_cdrom_update_speed(drive, &cap); @@ -2892,10 +2889,7 @@ int ide_cdrom_setup (ide_drive_t *drive) Some versions of this drive like to talk BCD. */ CDROM_CONFIG_FLAGS(drive)->toctracks_as_bcd = 1; CDROM_CONFIG_FLAGS(drive)->tocaddr_as_bcd = 1; - CDROM_CONFIG_FLAGS(drive)->playmsf_as_bcd = 1; - CDROM_CONFIG_FLAGS(drive)->subchan_as_bcd = 1; } - else if (strcmp (drive->id->model, "V006E0DS") == 0 && drive->id->fw_rev[4] == '1' && drive->id->fw_rev[6] <= '2') { @@ -2908,16 +2902,8 @@ int ide_cdrom_setup (ide_drive_t *drive) This drive was released before the 1.2 version of the spec. */ CDROM_CONFIG_FLAGS(drive)->tocaddr_as_bcd = 1; - CDROM_CONFIG_FLAGS(drive)->playmsf_as_bcd = 1; - CDROM_CONFIG_FLAGS(drive)->subchan_as_bcd = 1; CDROM_CONFIG_FLAGS(drive)->nec260 = 1; } - else if (strcmp(drive->id->model, "WEARNES CDD-120") == 0 && - strncmp(drive->id->fw_rev, "A1.1", 4) == 0) { /* FIXME */ - /* Wearnes */ - CDROM_CONFIG_FLAGS(drive)->playmsf_as_bcd = 1; - CDROM_CONFIG_FLAGS(drive)->subchan_as_bcd = 1; - } /* * Sanyo 3 CD changer uses a non-standard command for CD changing * (by default standard ATAPI support for CD changers is used). diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h index e6f219772549..d224b062db52 100644 --- a/drivers/ide/ide-cd.h +++ b/drivers/ide/ide-cd.h @@ -59,10 +59,8 @@ struct ide_cd_config_flags { __u8 no_doorlock : 1; /* Drive cannot lock the door. */ __u8 no_eject : 1; /* Drive cannot eject the disc. */ __u8 nec260 : 1; /* Drive is a pre-1.2 NEC 260 drive. */ - __u8 playmsf_as_bcd : 1; /* PLAYMSF command takes BCD args. */ __u8 tocaddr_as_bcd : 1; /* TOC addresses are in BCD. */ __u8 toctracks_as_bcd : 1; /* TOC track numbers are in BCD. */ - __u8 subchan_as_bcd : 1; /* Subchannel info is in BCD. */ __u8 is_changer : 1; /* Drive is a changer. */ __u8 cd_r : 1; /* Drive can write to CD-R media . */ __u8 cd_rw : 1; /* Drive can write to CD-R/W media . */ @@ -70,19 +68,14 @@ struct ide_cd_config_flags { __u8 dvd_r : 1; /* Drive can write DVD-R */ __u8 dvd_ram : 1; /* Drive can write DVD-RAM */ __u8 ram : 1; /* generic WRITE (dvd-ram/mrw) */ - __u8 test_write : 1; /* Drive can fake writes */ - __u8 supp_disc_present : 1; /* Changer can report exact contents - of slots. */ __u8 limit_nframes : 1; /* Drive does not provide data in multiples of SECTOR_SIZE when more than one interrupt is needed. */ __u8 seeking : 1; /* Seeking in progress */ __u8 audio_play : 1; /* can do audio related commands */ __u8 close_tray : 1; /* can close the tray */ - __u8 writing : 1; /* pseudo write in progress */ __u8 mo_drive : 1; /* drive is an MO device */ __u8 no_speed_select : 1; /* SET_CD_SPEED command is unsupported. */ - __u8 reserved : 1; byte max_speed; /* Max speed of the drive */ }; #define CDROM_CONFIG_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->config_flags)) -- cgit v1.2.3 From f18f960c5c1568fa2f720e2cb31d6c1af9ea1e1a Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:19 +0100 Subject: ide-cd: remove struct atapi_{mechstat_header,changer_info,slot} * Remove ->changer_info from struct cdrom_info (it is never allocated). * Remove unused struct atapi_{mechstat_header,changer_info,slot}. Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.c | 1 - drivers/ide/ide-cd.h | 55 ---------------------------------------------------- 2 files changed, 56 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index c736f769bff3..f02ddc5b3b17 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -2969,7 +2969,6 @@ static void ide_cd_release(struct kref *kref) kfree(info->buffer); kfree(info->toc); - kfree(info->changer_info); if (devinfo->handle == drive && unregister_cdrom(devinfo)) printk(KERN_ERR "%s: %s failed to unregister device from the cdrom " "driver.\n", __FUNCTION__, drive->name); diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h index d224b062db52..5bda4ec9ad2d 100644 --- a/drivers/ide/ide-cd.h +++ b/drivers/ide/ide-cd.h @@ -357,59 +357,6 @@ struct atapi_capabilities_page { char pad[4]; }; - -struct atapi_mechstat_header { -#if defined(__BIG_ENDIAN_BITFIELD) - __u8 fault : 1; - __u8 changer_state : 2; - __u8 curslot : 5; -#elif defined(__LITTLE_ENDIAN_BITFIELD) - __u8 curslot : 5; - __u8 changer_state : 2; - __u8 fault : 1; -#else -#error "Please fix " -#endif - -#if defined(__BIG_ENDIAN_BITFIELD) - __u8 mech_state : 3; - __u8 door_open : 1; - __u8 reserved1 : 4; -#elif defined(__LITTLE_ENDIAN_BITFIELD) - __u8 reserved1 : 4; - __u8 door_open : 1; - __u8 mech_state : 3; -#else -#error "Please fix " -#endif - - byte curlba[3]; - byte nslots; - __u16 slot_tablelen; -}; - - -struct atapi_slot { -#if defined(__BIG_ENDIAN_BITFIELD) - __u8 disc_present : 1; - __u8 reserved1 : 6; - __u8 change : 1; -#elif defined(__LITTLE_ENDIAN_BITFIELD) - __u8 change : 1; - __u8 reserved1 : 6; - __u8 disc_present : 1; -#else -#error "Please fix " -#endif - - byte reserved2[3]; -}; - -struct atapi_changer_info { - struct atapi_mechstat_header hdr; - struct atapi_slot slots[0]; -}; - /* Extra per-device info for cdrom drives. */ struct cdrom_info { ide_drive_t *drive; @@ -434,8 +381,6 @@ struct cdrom_info { int dma; unsigned long last_block; unsigned long start_seek; - /* Buffer to hold mechanism status and changer slot table. */ - struct atapi_changer_info *changer_info; struct ide_cd_config_flags config_flags; struct ide_cd_state_flags state_flags; -- cgit v1.2.3 From 481c8c6476f86d7e92435764ba710315d644a45e Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:20 +0100 Subject: ide-cd: cleanup ide_cdrom_update_speed() Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index f02ddc5b3b17..0f6d2e065b9a 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -2416,19 +2416,20 @@ int ide_cdrom_get_capabilities(ide_drive_t *drive, struct atapi_capabilities_pag static void ide_cdrom_update_speed (ide_drive_t *drive, struct atapi_capabilities_page *cap) { + u16 curspeed, maxspeed; + /* The ACER/AOpen 24X cdrom has the speed fields byte-swapped */ if (!drive->id->model[0] && !strncmp(drive->id->fw_rev, "241N", 4)) { - CDROM_STATE_FLAGS(drive)->current_speed = - (le16_to_cpu(cap->curspeed) + (176/2)) / 176; - CDROM_CONFIG_FLAGS(drive)->max_speed = - (le16_to_cpu(cap->maxspeed) + (176/2)) / 176; + curspeed = le16_to_cpu(cap->curspeed); + maxspeed = le16_to_cpu(cap->maxspeed); } else { - CDROM_STATE_FLAGS(drive)->current_speed = - (be16_to_cpu(cap->curspeed) + (176/2)) / 176; - CDROM_CONFIG_FLAGS(drive)->max_speed = - (be16_to_cpu(cap->maxspeed) + (176/2)) / 176; + curspeed = be16_to_cpu(cap->curspeed); + maxspeed = be16_to_cpu(cap->maxspeed); } + + CDROM_STATE_FLAGS(drive)->current_speed = (curspeed + (176/2)) / 176; + CDROM_CONFIG_FLAGS(drive)->max_speed = (maxspeed + (176/2)) / 176; } static -- cgit v1.2.3 From 20e7f7efa3da3678c65cea45903260dfabb8264c Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:20 +0100 Subject: ide-cd: add IDE_CD_CAPABILITIES define While at it remove stale/incorrect comment. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 0f6d2e065b9a..d8c2ce1f9854 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -2580,11 +2580,13 @@ void ide_cdrom_release_real (struct cdrom_device_info *cdi) CDROM_STATE_FLAGS(drive)->toc_valid = 0; } +#define IDE_CD_CAPABILITIES \ + (CDC_CLOSE_TRAY | CDC_OPEN_TRAY | CDC_LOCK | CDC_SELECT_SPEED | \ + CDC_SELECT_DISC | CDC_MULTI_SESSION | CDC_MCN | CDC_MEDIA_CHANGED | \ + CDC_PLAY_AUDIO | CDC_RESET | CDC_DRIVE_STATUS | CDC_CD_R | \ + CDC_CD_RW | CDC_DVD | CDC_DVD_R | CDC_DVD_RAM | CDC_GENERIC_PACKET | \ + CDC_MO_DRIVE | CDC_MRW | CDC_MRW_W | CDC_RAM) - -/**************************************************************************** - * Device initialization. - */ static struct cdrom_device_ops ide_cdrom_dops = { .open = ide_cdrom_open_real, .release = ide_cdrom_release_real, @@ -2597,14 +2599,7 @@ static struct cdrom_device_ops ide_cdrom_dops = { .get_mcn = ide_cdrom_get_mcn, .reset = ide_cdrom_reset, .audio_ioctl = ide_cdrom_audio_ioctl, - .capability = CDC_CLOSE_TRAY | CDC_OPEN_TRAY | CDC_LOCK | - CDC_SELECT_SPEED | CDC_SELE