Re: new regression in 2.6.25-rc3: can't resume from suspend to ram, ata1 errors

2008-02-25 Thread Bartlomiej Zolnierkiewicz
On Monday 25 February 2008, Rafael J. Wysocki wrote:
 On Monday, 25 of February 2008, Michael S. Tsirkin wrote:
  On my T61p, 2.6.25-rc2 seems to wake up fine from suspend to ram.
  Not so 2.6.25-rc3: it hangs on suspend to ram, with a blank screen.
 
 Thanks for the report.
 
  At one point I got lucky and got this on console (wrote down by hand,
  there could be typos):
  ata1: COMRESET failed (errno=-16)
  ata1: COMRESET failed (errno=-16)
  end_request: I/O error, dev sda sector 200554
  Buffer I/O error on device dm-0, logical block 256
  Buffer I/O error on device dm-0, logical block 15695875
  Buffer I/O error on device dm-0, logical block 15695878
  Buffer I/O error on device dm-0, logical block 15695887
  Buffer I/O error on device dm-0, logical block 15695896
  Buffer I/O error on device dm-0, logical block 15695914
  Buffer I/O error on device dm-0, logical block 15958028
  Buffer I/O error on device dm-0, logical block 22118530
  Buffer I/O error on device dm-0, logical block 22315068
  Buffer I/O error on device dm-0, logical block 22347824
  
  git bisect points at this commit:
  commit 559bbe6cbd0d8c68d40076a5f7dc98e3bf5864b2.
  power_state: get rid of write-only variable in SATA
 
 Jeff, could you revert it, please?

Jeff, this was applied between -rc2 and -rc3.

100% cleanup patches which change behavior are potentialy
risky and shouldn't be considered as a -rc material.

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Fixed PATCH] hpt366: fix section mismatch warnings

2008-02-24 Thread Bartlomiej Zolnierkiewicz
On Saturday 23 February 2008, Sam Ravnborg wrote:
 hpt366: fix section mismatch warnings
 
 Fix following warnings:
 WARNING: o-sparc64/vmlinux.o(.data+0x195a38): Section mismatch in reference 
 from the variable hpt37x_info.0 to the variable .devinit.data:hpt370
 WARNING: o-sparc64/vmlinux.o(.data+0x195a40): Section mismatch in reference 
 from the variable hpt37x_info.0 to the variable .devinit.data:hpt370a
 WARNING: o-sparc64/vmlinux.o(.data+0x195a48): Section mismatch in reference 
 from the variable hpt37x_info.0 to the variable .devinit.data:hpt372
 WARNING: o-sparc64/vmlinux.o(.data+0x195a50): Section mismatch in reference 
 from the variable hpt37x_info.0 to the variable .devinit.data:hpt372n
 
 Replace a static array with a small switch resulting in
 more readable code.
 Mark the pci table __devinitconst.
 
 A lot of variables are const but annotated __devinitdata.
 Annotating them __devinitconst would cause a section type
 conflict error when build for 64 bit powerpc.
 
 Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
 Cc: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
 Cc: Sergei Shtylyov [EMAIL PROTECTED]
 ---

thanks, applied

 The first patch I posted caused a section type conflict when
 build for 64 bit powerpc. The actual cause of this is know and unavoidable
 when we start to declare variables const.
 The patch attached is much simpler as the transition from __devinitdata
 to __devinitconst turned out to be bogus.

Weird, I thought that the main purpose of __devinitconst was to replace
const + __devinitdata?
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/10] IDE: Coding Style Fixes

2008-02-24 Thread Bartlomiej Zolnierkiewicz

On Saturday 23 February 2008, Paolo Ciarrocchi wrote:
 Hi Bartlomiej,
 The following 10 patches remove a huge number of errors and warnings
 reported by checkpatch.pl from the IDE subsystem.

[...]

Thanks!

I applied everything (patch #8 with fixes based on comments from
Adrian  Cyrill + patches #1/2/4/5 also with some improvements)
and verified that md5sums for the resulting binary files remain
the same.

Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/6] IDE: new series of Coding Style Fixes

2008-02-24 Thread Bartlomiej Zolnierkiewicz

On Saturday 23 February 2008, Paolo Ciarrocchi wrote:
 Bart,
 here is a new series of patches that remove some errors
 and warnings reported by checkpatch.pl from the IDE subsystem.
 
 All the patches have been compile tested and are against this morning (CET 
 time :-)
 linux-next
 
 Paolo Ciarrocchi (6):
   IDE: Coding Style fixes to drivers/ide/pci/opti621.c
   IDE: Coding Style fixes to drivers/ide/legacy/hd.c
   IDE: Coding Style fixes to drivers/ide/legacy/ali14xx.c
   IDE: Coding Style fixes to drivers/ide/pci/it8213.c

the above change (patch 4/6) seems to be m.i.a. ?

   IDE: Coding Style fixes to drivers/ide/ide-floppy.c
   IDE: Coding Style fixes to drivers/ide/pci/cmd640.c
 
  drivers/ide/ide-floppy.c |4 +-
  drivers/ide/legacy/ali14xx.c |   11 +++--
  drivers/ide/legacy/hd.c  |   79 ++--
  drivers/ide/pci/cmd640.c |   90 
 +-
  drivers/ide/pci/it8213.c |9 ++--
  drivers/ide/pci/opti621.c|   50 
  6 files changed, 122 insertions(+), 121 deletions(-)

I applied all the rest (some with minor fixes).

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [git patches] libata fixes

2008-02-24 Thread Bartlomiej Zolnierkiewicz
On Sunday 24 February 2008, Jeff Garzik wrote:

[...]

 Alan Cox (1):
   pata_atiixp: Use 255 sector limit

AHCI needs sorting too but this deals with the old interface

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]

[...]

 diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c
 index 9623f52..408bdc1 100644
 --- a/drivers/ata/pata_atiixp.c
 +++ b/drivers/ata/pata_atiixp.c
 @@ -227,7 +227,7 @@ static struct scsi_host_template atiixp_sht = {
   .queuecommand   = ata_scsi_queuecmd,
   .can_queue  = ATA_DEF_QUEUE,
   .this_id= ATA_SHT_THIS_ID,
 - .sg_tablesize   = LIBATA_MAX_PRD,
 + .sg_tablesize   = LIBATA_DUMB_MAX_PRD,
   .cmd_per_lun= ATA_SHT_CMD_PER_LUN,
   .emulated   = ATA_SHT_EMULATED,
   .use_clustering = ATA_SHT_USE_CLUSTERING,
 @@ -259,7 +259,7 @@ static struct ata_port_operations atiixp_port_ops = {
   .bmdma_stop = atiixp_bmdma_stop,
   .bmdma_status   = ata_bmdma_status,
  
 - .qc_prep= ata_qc_prep,
 + .qc_prep= ata_dumb_qc_prep,
   .qc_issue   = ata_qc_issue_prot,
  
   .data_xfer  = ata_data_xfer,

This patch doesn't enforce 255 sector limit but instead:

- limits max PRD table size from 128 entries to 64

- enables quirk needed for some chipsets to split 64K PRD table entry
  on two 32K ones (these chipsets choke on size == 0x)

From the patch description it can't be told whether the patch itself is
correct and only the patch description is bogus...

Alan/Jeff: please elaborate on what the patch is trying to achieve.

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [git patches] libata fixes

2008-02-24 Thread Bartlomiej Zolnierkiewicz
On Sunday 24 February 2008, Alan Cox wrote:
  From the patch description it can't be told whether the patch itself is
  correct and only the patch description is bogus...
 
 zero length PRD misparsing. If I remember rightly old IDE never generates
 64K PRD slots because other hardware can't handle it either (CS5520/30
 etc)

OK, that would explain it.

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: IDE cdrom problem with PLEXTOR DVDR PX-608AL

2008-02-24 Thread Bartlomiej Zolnierkiewicz
On Sunday 24 February 2008, Borislav Petkov wrote:
 On Sun, Feb 24, 2008 at 03:38:34PM +1000, Brad Rosser wrote:

[...]

  kernel: hda: cdrom_pc_intr: The drive appears confused (ireason =
  0x01). Trying to recover by ending request.
  last message repeated 3 times
  kernel: ide: failed opcode was: unknown
  kernel: hda: drive not ready for command
  kernel: hda: status error: status=0x58 { DriveReady SeekComplete 
  DataRequest }

[...]

  When I saw the recent message from Hans-Peter Jansen about this exact
  problem, and Boris's comment that something in interrupt land for the
  CD driver had been fixed, I thought the latest version of the kernel would
  rectify matters.  I installed the 2.6.25-rc2 kernel from kernel.org
  but the problem
  is still there.

Does the following patch help?

[ It makes ireason handling for REQ_TYPE_ATA_PC requests be the same as
  for other request types so ireason == 1 quirk is used if needed. ]

---
 drivers/ide/ide-cd.c |   24 ++--
 1 file changed, 10 insertions(+), 14 deletions(-)

Index: b/drivers/ide/ide-cd.c
===
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -670,8 +670,8 @@ static void cdrom_buffer_sectors (ide_dr
  * and attempt to recover if there are problems.  Returns  0 if everything's
  * ok; nonzero if the request has been terminated.
  */
-static
-int ide_cd_check_ireason(ide_drive_t *drive, int len, int ireason, int rw)
+static int ide_cd_check_ireason(ide_drive_t *drive, struct request *rq,
+   int len, int ireason, int rw)
 {
/*
 * ireason == 0: the drive wants to receive data from us
@@ -701,6 +701,9 @@ int ide_cd_check_ireason(ide_drive_t *dr
drive-name, __FUNCTION__, ireason);
}
 
+   if (rq-cmd_type == REQ_TYPE_ATA_PC)
+   rq-cmd_flags |= REQ_FAILED;
+
cdrom_end_request(drive, 0);
return -1;
 }
@@ -1071,11 +1074,11 @@ static ide_startstop_t cdrom_newpc_intr(
/*
 * check which way to transfer data
 */
-   if (blk_fs_request(rq) || blk_pc_request(rq)) {
-   if (ide_cd_check_ireason(drive, len, ireason, write))
-   return ide_stopped;
+   if (ide_cd_check_ireason(drive, rq, len, ireason, write))
+   return ide_stopped;
 
-   if (blk_fs_request(rq)  write == 0) {
+   if (blk_fs_request(rq)) {
+   if (write == 0) {
int nskip;
 
if (ide_cd_check_transfer_size(drive, len)) {
@@ -1101,16 +1104,9 @@ static ide_startstop_t cdrom_newpc_intr(
if (ireason == 0) {
write = 1;
xferfunc = HWIF(drive)-atapi_output_bytes;
-   } else if (ireason == 2 || (ireason == 1 
-  (blk_fs_request(rq) || blk_pc_request(rq {
+   } else {
write = 0;
xferfunc = HWIF(drive)-atapi_input_bytes;
-   } else {
-   printk(KERN_ERR %s: %s: The drive 
-   appears confused (ireason = 0x%02x). 
-   Trying to recover by ending request.\n,
-   drive-name, __FUNCTION__, ireason);
-   goto end_request;
}
 
/*
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] qd65xx: fix setup of QD6580 Control register

2008-02-23 Thread Bartlomiej Zolnierkiewicz
Control register of QD6580 should be setup before probing for devices.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
goes after ide: skip probing port if hdx=noprobe was used for both
devices on it patch in the IDE quilt tree

 drivers/ide/legacy/qd65xx.c |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

Index: b/drivers/ide/legacy/qd65xx.c
===
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -444,6 +444,8 @@ static int __init qd_probe(int base)
printk(KERN_DEBUG qd6580: config=%#x, control=%#x, ID3=%u\n,
config, control, QD_ID3);
 
+   outb(QD_DEF_CONTR, QD_CONTROL_PORT);
+
if (control  QD_CONTR_SEC_DISABLED) {
/* secondary disabled */
 
@@ -460,8 +462,6 @@ static int __init qd_probe(int base)
 
ide_device_add(idx, qd65xx_port_info);
 
-   outb(QD_DEF_CONTR, QD_CONTROL_PORT);
-
return 1;
} else {
ide_hwif_t *mate;
@@ -487,8 +487,6 @@ static int __init qd_probe(int base)
 
ide_device_add(idx, qd65xx_port_info);
 
-   outb(QD_DEF_CONTR, QD_CONTROL_PORT);
-
return 0; /* no other qd65xx possible */
}
}
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] qd65xx: always use -selectproc method

2008-02-23 Thread Bartlomiej Zolnierkiewicz
qd_select() checks itself whether timings should be reprogrammed so
remove superfluous qd_timing_ok() and always use -selectproc method
(rename qd_select() to qd65xx_select() while at it).

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/legacy/qd65xx.c |   37 ++---
 1 file changed, 10 insertions(+), 27 deletions(-)

Index: b/drivers/ide/legacy/qd65xx.c
===
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -88,12 +88,12 @@
 static int timings[4]={-1,-1,-1,-1}; /* stores current timing for each timer */
 
 /*
- * qd_select:
+ * qd65xx_select:
  *
- * This routine is invoked from ide.c to prepare for access to a given drive.
+ * This routine is invoked to prepare for access to a given drive.
  */
 
-static void qd_select (ide_drive_t *drive)
+static void qd65xx_select(ide_drive_t *drive)
 {
u8 index = ((   (QD_TIMREG(drive))  0x80 )  7) |
(QD_TIMREG(drive)  0x02);
@@ -168,36 +168,15 @@ static int qd_find_disk_type (ide_drive_
 }
 
 /*
- * qd_timing_ok:
- *
- * check whether timings don't conflict
- */
-
-static int qd_timing_ok (ide_drive_t drives[])
-{
-   return (IDE_IMPLY(drives[0].present  drives[1].present,
-   IDE_IMPLY(QD_TIMREG(drives) == QD_TIMREG(drives+1),
- QD_TIMING(drives) == QD_TIMING(drives+1;
-   /* if same timing register, must be same timing */
-}
-
-/*
  * qd_set_timing:
  *
- * records the timing, and enables selectproc as needed
+ * records the timing
  */
 
 static void qd_set_timing (ide_drive_t *drive, u8 timing)
 {
-   ide_hwif_t *hwif = HWIF(drive);
-
drive-drive_data = 0xff00;
drive-drive_data |= timing;
-   if (qd_timing_ok(hwif-drives)) {
-   qd_select(drive); /* selects once */
-   hwif-selectproc = NULL;
-   } else
-   hwif-selectproc = qd_select;
 
printk(KERN_DEBUG %s: %#x\n, drive-name, timing);
 }
@@ -400,7 +379,8 @@ static int __init qd_probe(int base)
qd_setup(hwif, base, config);
 
hwif-port_init_devs = qd6500_port_init_devs;
-   hwif-set_pio_mode = qd6500_set_pio_mode;
+   hwif-set_pio_mode   = qd6500_set_pio_mode;
+   hwif-selectproc = qd65xx_select;
 
idx[unit] = unit;
 
@@ -441,7 +421,8 @@ static int __init qd_probe(int base)
qd_setup(hwif, base, config | (control  8));
 
hwif-port_init_devs = qd6580_port_init_devs;
-   hwif-set_pio_mode = qd6580_set_pio_mode;
+   hwif-set_pio_mode   = qd6580_set_pio_mode;
+   hwif-selectproc = qd65xx_select;
 
idx[unit] = unit;
 
@@ -460,6 +441,7 @@ static int __init qd_probe(int base)
qd_setup(hwif, base, config | (control  8));
hwif-port_init_devs = qd6580_port_init_devs;
hwif-set_pio_mode   = qd6580_set_pio_mode;
+   hwif-selectproc = qd65xx_select;
idx[0] = 0;
}
 
@@ -469,6 +451,7 @@ static int __init qd_probe(int base)
qd_setup(mate, base, config | (control  8));
mate-port_init_devs = qd6580_port_init_devs;
mate-set_pio_mode   = qd6580_set_pio_mode;
+   hwif-selectproc = qd65xx_select;
idx[1] = 1;
}
 
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] qd65xx: use IDE_HFLAG_SINGLE host flag

2008-02-23 Thread Bartlomiej Zolnierkiewicz
* Set IDE_HFLAG_SINGLE host flag in qd_probe() for QD6500 and QD6580
  with the second port disabled.

* Check for IDE_HFLAG_SINGLE in qd6580_port_init_devs() instead of
  using cached value of QD6580 Control register.

* Don't cache QD6580 Control register value in hwif-config_data
  (bits 8-15) and remove no longer needed QD_CONTROL() macro.

* Cache QD65xx base address in hwif-config_data (bits 8-15)
  instead of hwif-select_data.

* Set hwif-config_data in qd_probe() and remove qd_setup() helper.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/legacy/qd65xx.c |   35 +++
 drivers/ide/legacy/qd65xx.h |1 -
 2 files changed, 15 insertions(+), 21 deletions(-)

Index: b/drivers/ide/legacy/qd65xx.c
===
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -204,10 +204,11 @@ static void qd6500_set_pio_mode(ide_driv
 
 static void qd6580_set_pio_mode(ide_drive_t *drive, const u8 pio)
 {
-   int base = HWIF(drive)-select_data;
+   ide_hwif_t *hwif = drive-hwif;
unsigned int cycle_time;
int active_time   = 175;
int recovery_time = 415; /* worst case values from the dos driver */
+   u8 base = (hwif-config_data  0xff00)  8;
 
if (drive-id  !qd_find_disk_type(drive, active_time, 
recovery_time)) {
cycle_time = ide_pio_cycle_time(drive, pio);
@@ -278,21 +279,10 @@ static int __init qd_testreg(int port)
return (readreg != QD_TESTVAL);
 }
 
-/*
- * qd_setup:
- *
- * called to setup an ata channel : adjusts attributes  links for tuning
- */
-
-static void __init qd_setup(ide_hwif_t *hwif, int base, int config)
-{
-   hwif-select_data = base;
-   hwif-config_data = config;
-}
-
 static void __init qd6500_port_init_devs(ide_hwif_t *hwif)
 {
-   u8 base = hwif-select_data, config = QD_CONFIG(hwif);
+   u8 base = (hwif-config_data  0xff00)  8;
+   u8 config = QD_CONFIG(hwif);
 
hwif-drives[0].drive_data = QD6500_DEF_DATA;
hwif-drives[1].drive_data = QD6500_DEF_DATA;
@@ -301,9 +291,10 @@ static void __init qd6500_port_init_devs
 static void __init qd6580_port_init_devs(ide_hwif_t *hwif)
 {
u16 t1, t2;
-   u8 base = hwif-select_data, config = QD_CONFIG(hwif);
+   u8 base = (hwif-config_data  0xff00)  8;
+   u8 config = QD_CONFIG(hwif);
 
-   if (QD_CONTROL(hwif)  QD_CONTR_SEC_DISABLED) {
+   if (hwif-host_flags  IDE_HFLAG_SINGLE) {
t1 = QD6580_DEF_DATA;
t2 = QD6580_DEF_DATA2;
} else
@@ -370,13 +361,15 @@ static int __init qd_probe(int base)
printk(KERN_DEBUG qd6500: config=%#x, ID3=%u\n,
config, QD_ID3);
 
+   d.host_flags |= IDE_HFLAG_SINGLE;
+
hwif = ide_find_port_slot(d);
if (hwif == NULL)
return -ENOENT;
 
ide_init_port_hw(hwif, hw[unit]);
 
-   qd_setup(hwif, base, config);
+   hwif-config_data = (base  8) | config;
 
hwif-port_init_devs = qd6500_port_init_devs;
hwif-set_pio_mode   = qd6500_set_pio_mode;
@@ -412,13 +405,15 @@ static int __init qd_probe(int base)
 
printk(KERN_INFO qd6580: single IDE board\n);
 
+   d.host_flags |= IDE_HFLAG_SINGLE;
+
hwif = ide_find_port_slot(d);
if (hwif == NULL)
return -ENOENT;
 
ide_init_port_hw(hwif, hw[unit]);
 
-   qd_setup(hwif, base, config | (control  8));
+   hwif-config_data = (base  8) | config;
 
hwif-port_init_devs = qd6580_port_init_devs;
hwif-set_pio_mode   = qd6580_set_pio_mode;
@@ -438,7 +433,7 @@ static int __init qd_probe(int base)
hwif = ide_find_port();
if (hwif) {
ide_init_port_hw(hwif, hw[0]);
-   qd_setup(hwif, base, config | (control  8));
+   hwif-config_data = (base  8) | config;
hwif-port_init_devs = qd6580_port_init_devs;
hwif-set_pio_mode   = qd6580_set_pio_mode;
hwif-selectproc = qd65xx_select;
@@ -448,7 +443,7 @@ static int __init qd_probe(int base)
mate = ide_find_port();
if (mate) {
ide_init_port_hw(mate, hw[1]);
-   qd_setup(mate, base, config | (control  8));
+   mate-config_data = (base  8) | config;
mate-port_init_devs = qd6580_port_init_devs;
mate-set_pio_mode   = qd6580_set_pio_mode

[PATCH 1/4] it821x: fix kzalloc() failure handling

2008-02-23 Thread Bartlomiej Zolnierkiewicz
Allocate 'struct it821x_dev' objects for both ports in it821x_init_one().

Fixes potential OOPS in it821x_quirkproc() (uses 'itdev' unconditionally)
and other problems ('itdev' is needed for correct operation of the driver).

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/pci/it821x.c |   24 ++--
 1 file changed, 18 insertions(+), 6 deletions(-)

Index: b/drivers/ide/pci/it821x.c
===
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -523,16 +523,12 @@ static void __devinit it821x_quirkproc(i
 static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
 {
struct pci_dev *dev = to_pci_dev(hwif-dev);
-   struct it821x_dev *idev = kzalloc(sizeof(struct it821x_dev), 
GFP_KERNEL);
+   struct it821x_dev **itdevs = (struct it821x_dev **)pci_get_drvdata(dev);
+   struct it821x_dev *idev = itdevs[hwif-channel];
u8 conf;
 
hwif-quirkproc = it821x_quirkproc;
 
-   if (idev == NULL) {
-   printk(KERN_ERR it821x: out of memory, falling back to legacy 
behaviour.\n);
-   return;
-   }
-
ide_set_hwifdata(hwif, idev);
 
pci_read_config_byte(dev, 0x50, conf);
@@ -641,6 +637,22 @@ static const struct ide_port_info it821x
 
 static int __devinit it821x_init_one(struct pci_dev *dev, const struct 
pci_device_id *id)
 {
+   struct it821x_dev *itdevs[2] = { NULL, NULL} , *itdev;
+   unsigned int i;
+
+   for (i = 0; i  2; i++) {
+   itdev = kzalloc(sizeof(*itdev), GFP_KERNEL);
+   if (itdev == NULL) {
+   kfree(itdevs[0]);
+   printk(KERN_ERR it821x: out of memory\n);
+   return -ENOMEM;
+   }
+
+   itdevs[i] = itdev;
+   }
+
+   pci_set_drvdata(dev, itdevs);
+
return ide_setup_pci_device(dev, it821x_chipsets[id-driver_data]);
 }
 
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] sis5513: fail early for unsupported chipsets

2008-02-23 Thread Bartlomiej Zolnierkiewicz
* Factor out chipset family detection from init_chipset_sis5513()
  to sis_find_family().

* Use sis_find_family() in sis5513_init_one() to fail early if the
  chipset is unsupported.

* Keep a local copy sis5513_chipset in sis5513_init_one()
  and set .udma_mask according to chipset family.

* Remove no longer need -ultra_mask setting from init_hwif_sis5513().

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/pci/sis5513.c |   27 +++
 1 file changed, 15 insertions(+), 12 deletions(-)

Index: b/drivers/ide/pci/sis5513.c
===
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -358,8 +358,7 @@ static u8 sis5513_ata133_udma_filter(ide
return (regdw  0x08) ? ATA_UDMA6 : ATA_UDMA5;
 }
 
-/* Chip detection and general config */
-static unsigned int __devinit init_chipset_sis5513 (struct pci_dev *dev, const 
char *name)
+static int __devinit sis_find_family(struct pci_dev *dev)
 {
struct pci_dev *host;
int i = 0;
@@ -440,9 +439,12 @@ static unsigned int __devinit init_chips
}
}
 
-   if (!chipset_family)
-   return -1;
+   return chipset_family;
+}
 
+static unsigned int __devinit init_chipset_sis5513(struct pci_dev *dev,
+  const char *name)
+{
/* Make general config ops here
   1/ tell IDE channels to operate in Compatibility mode only
   2/ tell old chips to allow per drive IDE timings */
@@ -548,8 +550,6 @@ static u8 __devinit ata66_sis5513(ide_hw
 
 static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif)
 {
-   u8 udma_rates[] = { 0x00, 0x00, 0x07, 0x1f, 0x3f, 0x3f, 0x7f, 0x7f };
-
hwif-set_pio_mode = sis_set_pio_mode;
hwif-set_dma_mode = sis_set_dma_mode;
 
@@ -557,11 +557,6 @@ static void __devinit init_hwif_sis5513 
hwif-udma_filter = sis5513_ata133_udma_filter;
 
hwif-cable_detect = ata66_sis5513;
-
-   if (hwif-dma_base == 0)
-   return;
-
-   hwif-ultra_mask = udma_rates[chipset_family];
 }
 
 static const struct ide_port_info sis5513_chipset __devinitdata = {
@@ -576,7 +571,15 @@ static const struct ide_port_info sis551
 
 static int __devinit sis5513_init_one(struct pci_dev *dev, const struct 
pci_device_id *id)
 {
-   return ide_setup_pci_device(dev, sis5513_chipset);
+   struct ide_port_info d = sis5513_chipset;
+   u8 udma_rates[] = { 0x00, 0x00, 0x07, 0x1f, 0x3f, 0x3f, 0x7f, 0x7f };
+
+   if (sis_find_family(dev) == 0)
+   return -ENOTSUPP;
+
+   d.udma_mask = udma_rates[chipset_family];
+
+   return ide_setup_pci_device(dev, d);
 }
 
 static const struct pci_device_id sis5513_pci_tbl[] = {
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] ide: sanitize handling of IDE_HFLAG_NO_SET_MODE host flag

2008-02-23 Thread Bartlomiej Zolnierkiewicz
* Check for IDE_HFLAG_NO_SET_MODE host flag in ide_set_pio(),
  ide_set_[pio,dma]_mode(), ide_set_xfer_rate() and set_pio_mode().

* Remove no longer needed IDE_HFLAG_NO_SET_MODE host flag checking
  from ide_tune_dma().

* Remove superfluous -set_pio_mode checking from do_special().

This is a part of preparations for adding 'struct ide_port_ops'.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-dma.c |3 ---
 drivers/ide/ide-io.c  |4 
 drivers/ide/ide-lib.c |   12 ++--
 drivers/ide/ide.c |4 +++-
 4 files changed, 13 insertions(+), 10 deletions(-)

Index: b/drivers/ide/ide-dma.c
===
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -706,9 +706,6 @@ static int ide_tune_dma(ide_drive_t *dri
if (!speed)
return 0;
 
-   if (hwif-host_flags  IDE_HFLAG_NO_SET_MODE)
-   return 1;
-
if (ide_set_dma_mode(drive, speed))
return 0;
 
Index: b/drivers/ide/ide-io.c
===
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -726,10 +726,6 @@ static ide_startstop_t do_special (ide_d
s-b.set_tune = 0;
 
if (set_pio_mode_abuse(drive-hwif, req_pio)) {
-
-   if (hwif-set_pio_mode == NULL)
-   return ide_stopped;
-
/*
 * take ide_lock for drive-[no_]unmask/[no_]io_32bit
 */
Index: b/drivers/ide/ide-lib.c
===
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -300,7 +300,8 @@ void ide_set_pio(ide_drive_t *drive, u8 
ide_hwif_t *hwif = drive-hwif;
u8 host_pio, pio;
 
-   if (hwif-set_pio_mode == NULL)
+   if (hwif-set_pio_mode == NULL ||
+   (hwif-host_flags  IDE_HFLAG_NO_SET_MODE))
return;
 
BUG_ON(hwif-pio_mask == 0x00);
@@ -353,6 +354,9 @@ int ide_set_pio_mode(ide_drive_t *drive,
 {
ide_hwif_t *hwif = drive-hwif;
 
+   if (hwif-host_flags  IDE_HFLAG_NO_SET_MODE)
+   return 0;
+
if (hwif-set_pio_mode == NULL)
return -1;
 
@@ -380,6 +384,9 @@ int ide_set_dma_mode(ide_drive_t *drive,
 {
ide_hwif_t *hwif = drive-hwif;
 
+   if (hwif-host_flags  IDE_HFLAG_NO_SET_MODE)
+   return 0;
+
if (hwif-set_dma_mode == NULL)
return -1;
 
@@ -410,7 +417,8 @@ int ide_set_xfer_rate(ide_drive_t *drive
 {
ide_hwif_t *hwif = drive-hwif;
 
-   if (hwif-set_dma_mode == NULL)
+   if (hwif-set_dma_mode == NULL ||
+   (hwif-host_flags  IDE_HFLAG_NO_SET_MODE))
return -1;
 
rate = ide_rate_filter(drive, rate);
Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -586,11 +586,13 @@ out:
 int set_pio_mode(ide_drive_t *drive, int arg)
 {
struct request rq;
+   ide_hwif_t *hwif = drive-hwif;
 
if (arg  0 || arg  255)
return -EINVAL;
 
-   if (drive-hwif-set_pio_mode == NULL)
+   if (hwif-set_pio_mode == NULL ||
+   (hwif-host_flags  IDE_HFLAG_NO_SET_MODE))
return -ENOSYS;
 
if (drive-special.b.set_tune)
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: 2.6.25-rc2 + smartd = hang

2008-02-23 Thread Bartlomiej Zolnierkiewicz

Hi,

On Saturday 23 February 2008, Anders Eriksson wrote:
 
 [EMAIL PROTECTED] said:
  But at this point libata is working much better than the old IDE stuff, and
  it really is worth moving things over if you can. 
 
  Ok, I'll take a stab at that tomorrow. Two things... 
 
 Having switched to ata_piix i can confirm that smartd doesn't hand the system 
 anymore.
 
 Still.. There seem to be a bug vs. the old drivers somewhere. Will that be 
 addressed, or should there be a big warning for the old stuff (DEPRECATED?)

Could you try bisecting it down to the guilty commit using git-bisect?

[ the old stuff got few hundred commits in 2.6.25 ]

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] hpt366: fix section mismatch warnings

2008-02-22 Thread Bartlomiej Zolnierkiewicz
On Friday 22 February 2008, Sergei Shtylyov wrote:
 Sam Ravnborg wrote:
 
  hpt366: fix section mismatch warnings
 
  Fix following warnings:
  WARNING: o-sparc64/vmlinux.o(.data+0x195a38): Section mismatch in reference 
  from the variable hpt37x_info.0 to the variable .devinit.data:hpt370
  WARNING: o-sparc64/vmlinux.o(.data+0x195a40): Section mismatch in reference 
  from the variable hpt37x_info.0 to the variable .devinit.data:hpt370a
  WARNING: o-sparc64/vmlinux.o(.data+0x195a48): Section mismatch in reference 
  from the variable hpt37x_info.0 to the variable .devinit.data:hpt372
  WARNING: o-sparc64/vmlinux.o(.data+0x195a50): Section mismatch in reference 
  from the variable hpt37x_info.0 to the variable .devinit.data:hpt372n
 
  Replace a static array with a small switch resulting in
  more readable code.
  Be consistent in use of __devinitconst for const data
  to avoid section type conflicts.
  Mark the pci table __devinitconst.
 
  Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
 
 Acked-by: Sergei Shtylyov [EMAIL PROTECTED]

applied
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] qd65xx: remove commented out code

2008-02-22 Thread Bartlomiej Zolnierkiewicz
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/legacy/qd65xx.c |   37 -
 1 file changed, 37 deletions(-)

Index: b/drivers/ide/legacy/qd65xx.c
===
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -334,43 +334,6 @@ static void __init qd6580_port_init_devs
hwif-drives[1].drive_data = t2;
 }
 
-/*
- * qd_unsetup:
- *
- * called to unsetup an ata channel : back to default values, unlinks tuning
- */
-/*
-static void __exit qd_unsetup(ide_hwif_t *hwif)
-{
-   u8 config = hwif-config_data;
-   int base = hwif-select_data;
-   void *set_pio_mode = (void *)hwif-set_pio_mode;
-
-   if (hwif-chipset != ide_qd65xx)
-   return;
-
-   printk(KERN_NOTICE %s: back to defaults\n, hwif-name);
-
-   hwif-selectproc = NULL;
-   hwif-set_pio_mode = NULL;
-
-   if (set_pio_mode == (void *)qd6500_set_pio_mode) {
-   // will do it for both
-   outb(QD6500_DEF_DATA, QD_TIMREG(hwif-drives[0]));
-   } else if (set_pio_mode == (void *)qd6580_set_pio_mode) {
-   if (QD_CONTROL(hwif)  QD_CONTR_SEC_DISABLED) {
-   outb(QD6580_DEF_DATA, QD_TIMREG(hwif-drives[0]));
-   outb(QD6580_DEF_DATA2, QD_TIMREG(hwif-drives[1]));
-   } else {
-   outb(hwif-channel ? QD6580_DEF_DATA2 : 
QD6580_DEF_DATA, QD_TIMREG(hwif-drives[0]));
-   }
-   } else {
-   printk(KERN_WARNING Unknown qd65xx tuning fonction !\n);
-   printk(KERN_WARNING keeping settings !\n);
-   }
-}
-*/
-
 static const struct ide_port_info qd65xx_port_info __initdata = {
.chipset= ide_qd65xx,
.host_flags = IDE_HFLAG_IO_32BIT |
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ide: remove stale comments from ide-dma.c

2008-02-22 Thread Bartlomiej Zolnierkiewicz
- ide-dma.c is not a separate module

- ide-dma.c is not PCI specific anymore

- DMA is enabled by default nowadays

- link for Intel Zappa BIOS is dead

etc.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-dma.c |   48 
 1 file changed, 48 deletions(-)

Index: b/drivers/ide/ide-dma.c
===
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -11,49 +11,6 @@
  */
 
 /*
- * This module provides support for the bus-master IDE DMA functions
- * of various PCI chipsets, including the Intel PIIX (i82371FB for
- * the 430 FX chipset), the PIIX3 (i82371SB for the 430 HX/VX and 
- * 440 chipsets), and the PIIX4 (i82371AB for the 430 TX chipset)
- * (PIIX stands for PCI ISA IDE Xcellerator).
- *
- * Pretty much the same code works for other IDE PCI bus-mastering chipsets.
- *
- * DMA is supported for all IDE devices (disk drives, cdroms, tapes, floppies).
- *
- * By default, DMA support is prepared for use, but is currently enabled only
- * for drives which already have DMA enabled (UltraDMA or mode 2 multi/single),
- * or which are recognized as good (see table below).  Drives with only mode0
- * or mode1 (multi/single) DMA should also work with this chipset/driver
- * (eg. MC2112A) but are not enabled by default.
- *
- * Use hdparm -i to view modes supported by a given drive.
- *
- * The hdparm-3.5 (or later) utility can be used for manually 
enabling/disabling
- * DMA support, but must be (re-)compiled against this kernel version or later.
- *
- * To enable DMA, use hdparm -d1 /dev/hd? on a per-drive basis after booting.
- * If problems arise, ide.c will disable DMA operation after a few retries.
- * This error recovery mechanism works and has been extremely well exercised.
- *
- * IDE drives, depending on their vintage, may support several different modes
- * of DMA operation.  The boot-time modes are indicated with a * in
- * the hdparm -i listing, and can be changed with *knowledgeable* use of
- * the hdparm -X feature.  There is seldom a need to do this, as drives
- * normally power-up with their best PIO/DMA modes enabled.
- *
- * Testing has been done with a rather extensive number of drives,
- * with Quantum  Western Digital models generally outperforming the pack,
- * and Fujitsu  Conner (and some Seagate which are really Conner) drives
- * showing more lackluster throughput.
- *
- * Keep an eye on /var/adm/messages for DMA disabled messages.
- *
- * Some people have reported trouble with Intel Zappa motherboards.
- * This can be fixed by upgrading the AMI BIOS to version 1.00.04.BS0,
- * available from ftp://ftp.intel.com/pub/bios/10004bs0.exe
- * (thanks to Glen Morrell [EMAIL PROTECTED] for researching this).
- *
  * Thanks to Christopher J. Reimer [EMAIL PROTECTED] for
  * fixing the problem with the BIOS on some Acer motherboards.
  *
@@ -65,11 +22,6 @@
  *
  * Most importantly, thanks to Robert Bringman [EMAIL PROTECTED]
  * for supplying a Promise UDMA board  WD UDMA drive for this work!
- *
- * And, yes, Intel Zappa boards really *do* use both PIIX IDE ports.
- *
- * ATA-66/100 and recovery functions, I forgot the rest..
- *
  */
 
 #include linux/module.h
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ide: remove ide-tape documentation from Documentation/ide.txt

2008-02-22 Thread Bartlomiej Zolnierkiewicz
More complete documentation is available in Documentation/ide/ide-tape.txt.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 Documentation/ide.txt |   47 ---
 1 file changed, 47 deletions(-)

Index: b/Documentation/ide.txt
===
--- a/Documentation/ide.txt
+++ b/Documentation/ide.txt
@@ -279,53 +279,6 @@ You also need to use probe kernel para
 
 

 
-IDE ATAPI streaming tape driver

-
-This driver is a part of the Linux ide driver and works in co-operation
-with linux/drivers/block/ide.c.
-
-The driver, in co-operation with ide.c, basically traverses the
-request-list for the block device interface. The character device
-interface, on the other hand, creates new requests, adds them
-to the request-list of the block device, and waits for their completion.
-
-Pipelined operation mode is now supported on both reads and writes.
-
-The block device major and minor numbers are determined from the
-tape's relative position in the ide interfaces, as explained in ide.c.
-
-The character device interface consists of the following devices:
-
- ht0   major 37, minor 0   first  IDE tape, rewind on close.
- ht1   major 37, minor 1   second IDE tape, rewind on close.
- ...
- nht0  major 37, minor 128 first  IDE tape, no rewind on close.
- nht1  major 37, minor 129 second IDE tape, no rewind on close.
- ...
-
-Run /dev/MAKEDEV to create the above entries.
-
-The general magnetic tape commands compatible interface, as defined by
-include/linux/mtio.h, is accessible through the character device.
-
-General ide driver configuration options, such as the interrupt-unmask
-flag, can be configured by issuing an ioctl to the block device interface,
-as any other ide device.
-
-Our own ide-tape ioctl's can be issued to either the block device or
-the character device interface.
-
-Maximal throughput with minimal bus load will usually be achieved in the
-following scenario:
-
-   1.  ide-tape is operating in the pipelined operation mode.
-   2.  No buffering is performed by the user backup program.
-
-
-
-
-
 Some Terminology
 
 IDE = Integrated Drive Electronics, meaning that each drive has a built-in
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ide: remove redundant comment from ide_unregister()

2008-02-22 Thread Bartlomiej Zolnierkiewicz
Identical comment is present in ide_hwif_release_regions() documentation.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
goes after hpt366: fix section mismatch warnings patch in IDE quilt tree

 drivers/ide/ide.c |5 -
 1 file changed, 5 deletions(-)

Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -590,11 +590,6 @@ void ide_unregister(unsigned int index, 
hwif-extra_ports = 0;
}
 
-   /*
-* Note that we only release the standard ports,
-* and do not even try to handle any extra ports
-* allocated for weird IDE interface chipsets.
-*/
ide_hwif_release_regions(hwif);
 
/* copy original settings */
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ide: skip probing port if hdx=noprobe was used for both devices on it

2008-02-22 Thread Bartlomiej Zolnierkiewicz
* Skip probing port if hdx=noprobe parameter was used for both devices on it.

* Obsolete idex=noprobe parameter - it only works for ide_generic, cmd640
  and PCI hosts in Compatibility mode (on alpha/x86/ia64/m32r/mips/ppc32).

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
goes after ide: remove redundant comment from ide_unregister() patch
in IDE quilt tree

 Documentation/ide.txt|2 --
 drivers/ide/ide-probe.c  |3 ++-
 drivers/ide/ide.c|2 +-
 drivers/ide/pci/cmd640.c |3 ++-
 4 files changed, 5 insertions(+), 5 deletions(-)

Index: b/Documentation/ide.txt
===
--- a/Documentation/ide.txt
+++ b/Documentation/ide.txt
@@ -258,8 +258,6 @@ Summary of ide driver parameters for ker
  As for VLB, it is safest to not specify it.
  Bigger values are safer than smaller ones.
 
- idex=noprobe: do not attempt to access/use this interface
- 
  idex=base   : probe for an interface at the addr specified,
  where base is usually 0x1f0 or 0x170
  and ctl is assumed to be base+0x206
Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -756,7 +756,8 @@ static int ide_probe_port(ide_hwif_t *hw
 
BUG_ON(hwif-present);
 
-   if (hwif-noprobe)
+   if (hwif-noprobe ||
+   (hwif-drives[0].noprobe  hwif-drives[1].noprobe))
return -EACCES;
 
/*
Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -1444,7 +1444,7 @@ static int __init ide_setup(char *s)
 
case -1: /* noprobe */
hwif-noprobe = 1;
-   goto done;
+   goto obsolete_option;
 
case 1: /* base */
vals[1] = vals[0] + 0x206; /* default ctl */
Index: b/drivers/ide/pci/cmd640.c
===
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -787,7 +787,8 @@ static int __init cmd640x_init(void)
/*
 * Try to enable the secondary interface, if not already enabled
 */
-   if (cmd_hwif1-noprobe) {
+   if (cmd_hwif1-noprobe ||
+   (cmd_hwif1-drives[0].noprobe  cmd_hwif1-drives[1].noprobe)) {
port2 = not probed;
} else {
b = get_cmd640_reg(CNTRL);
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ide: remove obsoleted idex=noprobe kernel parameter

2008-02-22 Thread Bartlomiej Zolnierkiewicz
* Remove obsoleted idex=noprobe kernel parameter.

* Remove no longer needed hwif-noprobe quirk from ide_hwif_configure()
  and hwif-noprobe checking from cmd640.c.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
goes before ide: move default IDE ports setup to ide_generic host driver
patch in IDE quilt tree

 drivers/ide/ide.c|6 ++
 drivers/ide/pci/cmd640.c |3 +--
 drivers/ide/setup-pci.c  |7 ---
 3 files changed, 3 insertions(+), 13 deletions(-)

Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -1144,7 +1144,7 @@ static int __init ide_setup(char *s)
 * (-8, -9, -10) are reserved to ease the hardcoding.
 */
static const char *ide_words[] = {
-   noprobe, serialize, minus3, minus4,
+   minus1, serialize, minus3, minus4,
reset, minus6, ata66, minus8, minus9,
minus10, four, qd65xx, ht6560b, cmd640_vlb,
dtc2278, umc8672, ali14xx, NULL };
@@ -1236,9 +1236,7 @@ static int __init ide_setup(char *s)
hwif-serialized = hwif-mate-serialized = 1;
goto obsolete_option;
 
-   case -1: /* noprobe */
-   hwif-noprobe = 1;
-   goto obsolete_option;
+   case -1:
case 0:
case 1:
case 2:
Index: b/drivers/ide/pci/cmd640.c
===
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -789,8 +789,7 @@ static int __init cmd640x_init(void)
/*
 * Try to enable the secondary interface, if not already enabled
 */
-   if (cmd_hwif1-noprobe ||
-   (cmd_hwif1-drives[0].noprobe  cmd_hwif1-drives[1].noprobe)) {
+   if (cmd_hwif1-drives[0].noprobe  cmd_hwif1-drives[1].noprobe) {
port2 = not probed;
} else {
b = get_cmd640_reg(CNTRL);
Index: b/drivers/ide/setup-pci.c
===
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -345,7 +345,6 @@ static ide_hwif_t *ide_hwif_configure(st
unsigned long ctl = 0, base = 0;
ide_hwif_t *hwif;
u8 bootable = (d-host_flags  IDE_HFLAG_BOOTABLE) ? 1 : 0;
-   u8 oldnoprobe = 0;
struct hw_regs_s hw;
 
if ((d-host_flags  IDE_HFLAG_ISA_PORTS) == 0) {
@@ -376,14 +375,8 @@ static ide_hwif_t *ide_hwif_configure(st
hw.chipset = d-chipset ? d-chipset : ide_pci;
ide_std_init_ports(hw, base, ctl | 2);
 
-   if (hwif-io_ports[IDE_DATA_OFFSET] == base 
-   hwif-io_ports[IDE_CONTROL_OFFSET] == (ctl | 2))
-   oldnoprobe = hwif-noprobe;
-
ide_init_port_hw(hwif, hw);
 
-   hwif-noprobe = oldnoprobe;
-
hwif-dev = dev-dev;
hwif-cds = d;
 
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ide: remove stale comments from ide-dma.c

2008-02-22 Thread Bartlomiej Zolnierkiewicz
On Friday 22 February 2008, Mark Lord wrote:
 Bartlomiej Zolnierkiewicz wrote:
  - ide-dma.c is not a separate module
  
  - ide-dma.c is not PCI specific anymore
  
  - DMA is enabled by default nowadays
  
  - link for Intel Zappa BIOS is dead
  
  etc.
  
  Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
  ---
   drivers/ide/ide-dma.c |   48 
  
   1 file changed, 48 deletions(-)
  
  Index: b/drivers/ide/ide-dma.c
  ===
  --- a/drivers/ide/ide-dma.c
  +++ b/drivers/ide/ide-dma.c
  @@ -11,49 +11,6 @@
*/
   
   /*
  - * This module provides support for the bus-master IDE DMA functions
  - * of various PCI chipsets, including the Intel PIIX (i82371FB for
  - * the 430 FX chipset), the PIIX3 (i82371SB for the 430 HX/VX and 
  - * 440 chipsets), and the PIIX4 (i82371AB for the 430 TX chipset)
  - * (PIIX stands for PCI ISA IDE Xcellerator).
  - *
  - * Pretty much the same code works for other IDE PCI bus-mastering 
  chipsets.
  - *
  - * DMA is supported for all IDE devices (disk drives, cdroms, tapes, 
  floppies).
 ..
 
 Those top comments still look relevant, or at least as relevant
 as the rest of the file (and subsystem) itself.  :)
 
 Sigh.

ide-dma.c supports _much_ more than IDE PCI BM-DMA nowadays :)

[ hmm, it probably makes sense to split CONFIG_BLK_DEV_IDEDMA_SFF code
  to a separate file (ide-dma-sff.c?) so ide-dma.c would contain only
  generic code ]

anyway here goes take 2:

[...]
v2:
* Some comments should be preserved. (Noticed by Mark Lord)

Cc: Mark Lord [EMAIL PROTECTED]
[...]

interdiff:

diff -u b/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
--- b/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -1,9 +1,13 @@
 /*
+ *  IDE DMA support (including IDE PCI BM-DMA).
+ *
  *  Copyright (C) 1995-1998   Mark Lord
  *  Copyright (C) 1999-2000   Andre Hedrick [EMAIL PROTECTED]
  *  Copyright (C) 2004, 2007  Bartlomiej Zolnierkiewicz
  *
  *  May be copied or modified under the terms of the GNU General Public License
+ *
+ *  DMA is supported for all IDE devices (disk drives, cdroms, tapes, 
floppies).
  */
 
 /*
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [BUG] next-20080219 - ide oops while bootup at ide_device_add_all ()

2008-02-20 Thread Bartlomiej Zolnierkiewicz

Hi,

On Wednesday 20 February 2008, Kamalesh Babulal wrote:
 Hi, 
 
 The next-20080219 kernel oops while booting up on x86_64 box. This bug
 was fixed in the 2.6.24-git(s) with the patch posted at
 http://lkml.org/lkml/2008/2/11/350 
 
 ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
 BUG: unable to handle kernel paging request at 80a37b8d
 IP: [8039470a] ide_device_add_all+0x1a5/0x517
 PGD 203067 PUD 207063 PMD 0 
 Oops:  [1] SMP 
 last sysfs file: 
 CPU 1 
 Modules linked in:
 Pid: 1, comm: swapper Not tainted 2.6.25-rc2-autotest-next-20080219 #1
 RIP: 0010:[8039470a]  [8039470a] 
 ide_device_add_all+0x1a5/0x517
 RSP: :8101e7125db0  EFLAGS: 00010206
 RAX: 000a8000 RBX: 0009 RCX: 0009
 RDX: 8101e7125e60 RSI:  RDI: 8101e7125e60
 RBP:  R08:  R09: 8101e68de870
 R10: 0177 R11: 0174 R12: 80990080
 R13:  R14: 000a R15: 
 FS:  () GS:8101e710d740() knlGS:
 CS:  0010 DS: 0018 ES: 0018 CR0: 8005003b
 CR2: 80a37b8d CR3: 00201000 CR4: 06e0
 DR0:  DR1:  DR2: 
 DR3:  DR6: 0ff0 DR7: 0400
 Process swapper (pid: 1, threadinfo 8101e7124000, task 8101e7123200)
 Stack:  8101e7125e60 0009 01f0 80990080
  0001 000a  8088d725
  0170 0171 0172 0173
 Call Trace:
  [8088d725] ide_generic_init+0x169/0x1d8
  [808706f7] kernel_init+0x17d/0x2e9
  [8020cc78] child_rip+0xa/0x12
  [8087057a] kernel_init+0x0/0x2e9
  [8020cc6e] child_rip+0x0/0x12
 
 
 Code: 49 ff c5 49 83 fe 0a 0f 85 97 fe ff ff 45 31 ed 48 8b 14 24 41 8a 44 15 
 00 3c ff 0f 84 4d 01 00 00 0f b6 c0 48 69 c0 00 0c 00 00 80 b8 8d fb 98 80 
 0d 48 8d 98 80 f4 98 80 75 15 48 8b 80 88 f4 
 RIP  [8039470a] ide_device_add_all+0x1a5/0x517
  RSP 8101e7125db0
 CR2: 80a37b8d
 ---[ end trace 31f82065a26d65bf ]---
 Kernel panic - not syncing: Attempted to kill init!

This is fixed now (thanks to Johann Felix Soden).

http://marc.info/?l=linux-idem=120351576111554w=2

[ actually this bug is a good thing because it is clear now that people
  are actively testing linux-next ;-) ]

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ide-generic: Fix no initalization of idx in some case

2008-02-20 Thread Bartlomiej Zolnierkiewicz
On Wednesday 20 February 2008, Johann Felix Soden wrote:
 From: Johann Felix Soden [EMAIL PROTECTED]
 
 If the slot is already occupied, there should be written 0xff to idx[i].
 In the ongoing code and in this case there are no writings to idx[i], so
 garbage stays in idx. The kernel get into a endless loop printing:
 
 : I/O resource 0x0-0x0 not free.
 Trying to free nonexistent resource -
 Trying to free nonexistent resource -
 
 This patch solves http://article.gmane.org/gmane.linux.ide/28810 .
 
 Signed-off-by: Johann Felix Soden [EMAIL PROTECTED]
 CC: Sergei Shtylyov [EMAIL PROTECTED]

Thanks!  I integrated it with the original patch to preserve bisectability:

From: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
Subject: [PATCH] ide-generic: use ide_find_port() (take 3)

There should be no functional changes caused by this patch.

v2:
* Fix comment (noticed by Sergei Shtylyov).

v3:
* Fix no initalization of idx in some case. (Johann Felix Soden)

Cc: Johann Felix Soden [EMAIL PROTECTED]
Cc: Kamalesh Babulal [EMAIL PROTECTED]
Cc: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-generic.c |   19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

Index: b/drivers/ide/ide-generic.c
===
--- a/drivers/ide/ide-generic.c
+++ b/drivers/ide/ide-generic.c
@@ -90,18 +90,29 @@ static int __init ide_generic_init(void)
int i;
 
for (i = 0; i  MAX_HWIFS; i++) {
-   ide_hwif_t *hwif = ide_hwifs[i];
+   ide_hwif_t *hwif;
unsigned long io_addr = ide_default_io_base(i);
hw_regs_t hw;
 
-   if (hwif-chipset == ide_unknown  io_addr) {
-   u8 oldnoprobe = hwif-noprobe;
+   if (io_addr) {
+   u8 oldnoprobe;
+
+   /*
+* Skip probing if the corresponding
+* slot is already occupied.
+*/
+   hwif = ide_find_port();
+   if (hwif == NULL || hwif-index != i) {
+   idx[i] = 0xff;
+   continue;
+   }
 
memset(hw, 0, sizeof(hw));
ide_std_init_ports(hw, io_addr, io_addr + 0x206);
hw.irq = ide_default_irq(io_addr);
-   ide_init_port_hw(hwif, hw);
 
+   oldnoprobe = hwif-noprobe;
+   ide_init_port_hw(hwif, hw);
hwif-noprobe = oldnoprobe;
 
idx[i] = i;
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] falconide: fix resources reservation

2008-02-20 Thread Bartlomiej Zolnierkiewicz
On Wednesday 20 February 2008, Geert Uytterhoeven wrote:
 On Wed, 20 Feb 2008, Bartlomiej Zolnierkiewicz wrote:
  * Tell IDE layer to not manage resources by setting
hwif-mmio flag and request resources in falconide_init().
  
  * Use request_mem_region() for resources reservation.
  
  * Use driver name for resources reservation.
  
  Cc: Geert Uytterhoeven [EMAIL PROTECTED]
  Cc: Michael Schmitz [EMAIL PROTECTED]
  Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
  ---
   drivers/ide/legacy/falconide.c |7 +++
   1 file changed, 7 insertions(+)
  
  Index: b/drivers/ide/legacy/falconide.c
  ===
  --- a/drivers/ide/legacy/falconide.c
  +++ b/drivers/ide/legacy/falconide.c
  @@ -22,6 +22,7 @@
   #include asm/atariints.h
   #include asm/atari_stdma.h
   
  +#define DRV_NAME falconide
   
   /*
*  Base of the IDE interface
  @@ -74,6 +75,11 @@ static int __init falconide_init(void)
   
  printk(KERN_INFO ide: Falcon IDE controller\n);
   
  +   if (!request_mem_region(ATA_HD_BASE, 0x40, DRV_NAME)) {
  +   printk(KERN_ERR %s: resources busy\n);
  ^^
 Woops, missing parameter?

thanks, fixed

 pr_error()?

dunno...

From: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
Subject: [PATCH] falconide: fix resources reservation (take 2)

* Tell IDE layer to not manage resources by setting
  hwif-mmio flag and request resources in falconide_init().

* Use request_mem_region() for resources reservation.

* Use driver name for resources reservation.

v2:
* Fix missing printk() parameter. (Noticed by Geert Uytterhoeven)

Cc: Geert Uytterhoeven [EMAIL PROTECTED]
Cc: Michael Schmitz [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/legacy/falconide.c |7 +++
 1 file changed, 7 insertions(+)

Index: b/drivers/ide/legacy/falconide.c
===
--- a/drivers/ide/legacy/falconide.c
+++ b/drivers/ide/legacy/falconide.c
@@ -22,6 +22,7 @@
 #include asm/atariints.h
 #include asm/atari_stdma.h
 
+#define DRV_NAME falconide
 
 /*
  *  Base of the IDE interface
@@ -74,6 +75,11 @@ static int __init falconide_init(void)
 
printk(KERN_INFO ide: Falcon IDE controller\n);
 
+   if (!request_mem_region(ATA_HD_BASE, 0x40, DRV_NAME)) {
+   printk(KERN_ERR %s: resources busy\n, DRV_NAME);
+   return -EBUSY;
+   }
+
falconide_setup_ports(hw);
 
hwif = ide_find_port();
@@ -83,6 +89,7 @@ static int __init falconide_init(void)
 
ide_init_port_data(hwif, index);
ide_init_port_hw(hwif, hw);
+   hwif-mmio = 1;
 
ide_get_lock(NULL, NULL);
ide_device_add(idx, NULL);
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] ide: fix enabling DMA on it821x in smart mode

2008-02-20 Thread Bartlomiej Zolnierkiewicz
ide_tune_dma() should return '1' if IDE_HFLAG_NO_SET_MODE host flag is set.

Cc: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
I wonder how this could have slipped in :(

Sergei, please double-check this patch.  Thanks!

 drivers/ide/ide-dma.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/drivers/ide/ide-dma.c
===
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -757,7 +757,7 @@ static int ide_tune_dma(ide_drive_t *dri
}
 
if (hwif-host_flags  IDE_HFLAG_NO_SET_MODE)
-   return 0;
+   return 1;
 
if (ide_set_dma_mode(drive, speed))
return 0;
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] ide: remove IDE_HFLAG_CY82C693 host flag

2008-02-20 Thread Bartlomiej Zolnierkiewicz
Sergei suggested that it shouldn't be necessary + it had no effect
anyway since ide_id_dma_bug() is called earlier in ide_tune_dma().

Cc: Sergei Shtylyov [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
I went ahead since I urgently needed to re-cycle one host flag.

 drivers/ide/ide-dma.c  |   10 ++
 drivers/ide/pci/cy82c693.c |2 +-
 include/linux/ide.h|2 --
 3 files changed, 3 insertions(+), 11 deletions(-)

Index: b/drivers/ide/ide-dma.c
===
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -747,14 +747,8 @@ static int ide_tune_dma(ide_drive_t *dri
 
speed = ide_max_dma_mode(drive);
 
-   if (!speed) {
-/* is this really correct/needed? */
-   if ((hwif-host_flags  IDE_HFLAG_CY82C693) 
-   ide_dma_good_drive(drive))
-   return 1;
-   else
-   return 0;
-   }
+   if (!speed)
+   return 0;
 
if (hwif-host_flags  IDE_HFLAG_NO_SET_MODE)
return 1;
Index: b/drivers/ide/pci/cy82c693.c
===
--- a/drivers/ide/pci/cy82c693.c
+++ b/drivers/ide/pci/cy82c693.c
@@ -410,7 +410,7 @@ static const struct ide_port_info cy82c6
.init_iops  = init_iops_cy82c693,
.init_hwif  = init_hwif_cy82c693,
.chipset= ide_cy82c693,
-   .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_CY82C693,
+   .host_flags = IDE_HFLAG_SINGLE,
.pio_mask   = ATA_PIO4,
.swdma_mask = ATA_SWDMA2,
.mwdma_mask = ATA_MWDMA2,
Index: b/include/linux/ide.h
===
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1089,8 +1089,6 @@ enum {
/* unmask IRQs */
IDE_HFLAG_UNMASK_IRQS   = (1  25),
IDE_HFLAG_ABUSE_SET_DMA_MODE= (1  26),
-   /* host is CY82C693 */
-   IDE_HFLAG_CY82C693  = (1  27),
/* force host out of simplex mode */
IDE_HFLAG_CLEAR_SIMPLEX = (1  28),
/* DSC overlap is unsupported */
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ide: remove hwif-straight8 flag

2008-02-20 Thread Bartlomiej Zolnierkiewicz
All host drivers now either set hwif-mmio or reserve continuous
I/O resources so remove no longer needed hwif-straight8 flag
and never reached code for 'hwif-straight8 == 0' case.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide.c   |   36 +++-
 include/linux/ide.h |1 -
 2 files changed, 11 insertions(+), 26 deletions(-)

Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -253,29 +253,21 @@ static struct resource* hwif_request_reg
 int ide_hwif_request_regions(ide_hwif_t *hwif)
 {
unsigned long addr;
-   unsigned int i;
 
if (hwif-mmio)
return 0;
+
addr = hwif-io_ports[IDE_CONTROL_OFFSET];
+
if (addr  !hwif_request_region(hwif, addr, 1))
goto control_region_busy;
-   hwif-straight8 = 0;
+
addr = hwif-io_ports[IDE_DATA_OFFSET];
-   if ((addr | 7) == hwif-io_ports[IDE_STATUS_OFFSET]) {
-   if (!hwif_request_region(hwif, addr, 8))
-   goto data_region_busy;
-   hwif-straight8 = 1;
-   return 0;
-   }
-   for (i = IDE_DATA_OFFSET; i = IDE_STATUS_OFFSET; i++) {
-   addr = hwif-io_ports[i];
-   if (!hwif_request_region(hwif, addr, 1)) {
-   while (--i)
-   release_region(addr, 1);
-   goto data_region_busy;
-   }
-   }
+   BUG_ON((addr | 7) != hwif-io_ports[IDE_STATUS_OFFSET]);
+
+   if (!hwif_request_region(hwif, addr, 8))
+   goto data_region_busy;
+
return 0;
 
 data_region_busy:
@@ -301,19 +293,13 @@ control_region_busy:
 
 void ide_hwif_release_regions(ide_hwif_t *hwif)
 {
-   u32 i = 0;
-
if (hwif-mmio)
return;
+
if (hwif-io_ports[IDE_CONTROL_OFFSET])
release_region(hwif-io_ports[IDE_CONTROL_OFFSET], 1);
-   if (hwif-straight8) {
-   release_region(hwif-io_ports[IDE_DATA_OFFSET], 8);
-   return;
-   }
-   for (i = IDE_DATA_OFFSET; i = IDE_STATUS_OFFSET; i++)
-   if (hwif-io_ports[i])
-   release_region(hwif-io_ports[i], 1);
+
+   release_region(hwif-io_ports[IDE_DATA_OFFSET], 8);
 }
 
 void ide_remove_port_from_hwgroup(ide_hwif_t *hwif)
Index: b/include/linux/ide.h
===
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -524,7 +524,6 @@ typedef struct hwif_s {
unsignedreset  : 1; /* reset after probe */
unsignedsg_mapped  : 1; /* sg_table and sg_nents are ready */
unsignedmmio   : 1; /* host uses MMIO */
-   unsignedstraight8  : 1; /* Alan's straight 8 check */
 
struct device   gendev;
struct class_device classdev;
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Optiarc DVD RW AD-5200A audio playing

2008-02-19 Thread Bartlomiej Zolnierkiewicz
On Tuesday 19 February 2008, Borislav Petkov wrote:

[...]

 Author: Borislav Petkov [EMAIL PROTECTED]
 Date:   Sat Feb 16 09:56:36 2008 +0100
 
 ide-cd: Enable audio play quirk for Optiarc DVD RW AD-5200A drive
 
 Reported-by: Stefan Bader [EMAIL PROTECTED]
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]

applied
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ide-cd: remove the internal 64k buffer

2008-02-19 Thread Bartlomiej Zolnierkiewicz

Hi,

On Tuesday 19 February 2008, Borislav Petkov wrote:
 Hi Bart,
 
 here's one more item from my TODO list. The removal is straight forward, after
 testing it with all my cdrom drives they all seem even to rotate quieter due 
 to
 the automatic speed adjustment of the drive to the continuous data stream
 bandwidth in contrast to the buffer-mode in which recurring buffer-fill 
 speedups
 caused the drive's read speeed to spike in order to keep the buffer filled up
 constantly.
 
 Still, i'd keep this a bit longer in -mm to see whether there are some
 other issues with it and with all the different workloads.
 
 
 commit a855bd5d94ddac678cf90b4b8f20dbd3ac8ea29a
 Author: Borislav Petkov [EMAIL PROTECTED]
 Date:   Tue Feb 19 14:25:09 2008 +0100
 
 ide-cd: remove the internal 64k buffer
 
 This removes the internal ide-cd buffer and falls back to read-ahead 
 block layer
 capabilities. Thorough testing (cd burning, dvd read, raw read) gives 
 with the
 bufferless mode marginally better performance in addition to simplified 
 code.
 
 bufferless:
 
 dd: reading `/dev/hdc': Input/output error
 6238+0 records in
 6238+0 records out
 204406784 bytes (204 MB) copied, 259.891 s, 787 kB/s
 
 real4m21.598s
 user0m0.014s
 sys 0m0.744s
 
 with the old buffer (2.6.25-rc1):
 
 dd: reading `/dev/hdc': Input/output error
 6238+0 records in
 6238+0 records out
 204406784 bytes (204 MB) copied, 262.893 s, 778 kB/s
 
 real4m22.938s
 user0m0.009s
 sys 0m0.771s
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]

applied, thanks
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/5] ide-generic: use ide_find_port()

2008-02-19 Thread Bartlomiej Zolnierkiewicz
On Tuesday 19 February 2008, Sergei Shtylyov wrote:
 Bartlomiej Zolnierkiewicz wrote:
 
  There should be no functional changes caused by this patch.
 
  Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
 
 Acked-by: Sergei Shtylyov [EMAIL PROTECTED]
 
  Index: b/drivers/ide/ide-generic.c
  ===
  --- a/drivers/ide/ide-generic.c
  +++ b/drivers/ide/ide-generic.c
  @@ -90,18 +90,27 @@ static int __init ide_generic_init(void)
  int i;
   
  for (i = 0; i  MAX_HWIFS; i++) {
  -   ide_hwif_t *hwif = ide_hwifs[i];
  +   ide_hwif_t *hwif;
  unsigned long io_addr = ide_default_io_base(i);
  hw_regs_t hw;
   
  -   if (hwif-chipset == ide_unknown  io_addr) {
  -   u8 oldnoprobe = hwif-noprobe;
  +   if (io_addr) {
  +   u8 oldnoprobe;
  +
  +   /*
  +* Skip probing if the corresponding
  +* slot entry is already occupied.
 
 IMHO, it's either slot or entry, else it sounds superfluous. :-)

I made 'take 2' with entry removed, thanks.
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 03/12] ide: add ide-4drives host driver

2008-02-19 Thread Bartlomiej Zolnierkiewicz
On Tuesday 19 February 2008, Sergei Shtylyov wrote:
 Bartlomiej Zolnierkiewicz wrote:
 
  CONFIG_BLK_DEV_4DRIVES deserves its own host driver:
 
  * Add drivers/ide/legacy/ide-4drives.c and move 4drives support there.
 
  * Add ide-4drives.o in the link order after all other legacy host
drivers enabled by ide0= options (they all are mutually exclusive).
 
  * Make ide-4drives host driver probe itself for IDE devices instead of
indirectly depending on ide_generic host driver.
 
  * Add probe module parameter to ide-4drives and update documentation.
 
  Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
 
  Index: b/drivers/ide/Kconfig
  ===
  --- a/drivers/ide/Kconfig
  +++ b/drivers/ide/Kconfig
  @@ -1042,8 +1042,8 @@ config BLK_DEV_4DRIVES
Certain older chipsets, including the Tekram 690CD, use a single set
of I/O ports at 0x1f0 to control up to four drives, instead of the
customary two drives per port. Support for this can be enabled at
  - runtime using the ide0=four kernel boot parameter if you say Y
  - here.
  + runtime using the ide_4drives.probe kernel boot parameter if you
 
 Not ide-4drives.probe?
 Looks correct otherwise.

I believe that both versions are correct but I fixed this in 'take 3' to
be on the safe side.

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ide_platform: fix resources handling

2008-02-19 Thread Bartlomiej Zolnierkiewicz
Tell IDE layer to not manage resources by always setting hwif-mmio flag
(resources are handled by a platform device).

Cc: Anton Vorontsov [EMAIL PROTECTED]
Cc: Vitaly Bordug [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/legacy/ide_platform.c |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Index: b/drivers/ide/legacy/ide_platform.c
===
--- a/drivers/ide/legacy/ide_platform.c
+++ b/drivers/ide/legacy/ide_platform.c
@@ -100,11 +100,10 @@ static int __devinit plat_ide_probe(stru
hw.dev = pdev-dev;
 
ide_init_port_hw(hwif, hw);
+   hwif-mmio = 1;
 
-   if (mmio) {
-   hwif-mmio = 1;
+   if (mmio)
default_hwif_mmiops(hwif);
-   }
 
idx[0] = hwif-index;
 
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] delkin_cb: fix resources handling

2008-02-19 Thread Bartlomiej Zolnierkiewicz
Tell IDE layer to not manage resources by setting hwif-mmio flag.

Cc: Mark Lord [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/pci/delkin_cb.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: b/drivers/ide/pci/delkin_cb.c
===
--- a/drivers/ide/pci/delkin_cb.c
+++ b/drivers/ide/pci/delkin_cb.c
@@ -71,7 +71,6 @@ delkin_cb_probe (struct pci_dev *dev, co
if (setup[i])
outb(setup[i], base + i);
}
-   pci_release_regions(dev);   /* IDE layer handles regions itself */
 
memset(hw, 0, sizeof(hw));
ide_std_init_ports(hw, base + 0x10, base + 0x1e);
@@ -90,6 +89,7 @@ delkin_cb_probe (struct pci_dev *dev, co
ide_init_port_data(hwif, i);
 
ide_init_port_hw(hwif, hw);
+   hwif-mmio = 1;
hwif-quirkproc = ide_undecoded_slave;
 
idx[0] = i;
@@ -110,6 +110,7 @@ delkin_cb_probe (struct pci_dev *dev, co
 
 out_disable:
printk(KERN_ERR delkin_cb: no IDE devices found\n);
+   pci_release_regions(dev);
pci_disable_device(dev);
return -ENODEV;
 }
@@ -122,6 +123,7 @@ delkin_cb_remove (struct pci_dev *dev)
if (hwif)
ide_unregister(hwif-index);
 
+   pci_release_regions(dev);
pci_disable_device(dev);
 }
 
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] bast-ide: fix resources reservation

2008-02-19 Thread Bartlomiej Zolnierkiewicz
* Tell IDE layer to not manage resources by setting
  hwif-mmio flag and request resources in bastide_init().

* Use request_mem_region() for resources reservation.

* Use driver name for resources reservation.

Cc: Ben Dooks [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/arm/bast-ide.c |   10 ++
 1 file changed, 10 insertions(+)

Index: b/drivers/ide/arm/bast-ide.c
===
--- a/drivers/ide/arm/bast-ide.c
+++ b/drivers/ide/arm/bast-ide.c
@@ -21,6 +21,8 @@
 #include asm/arch/bast-map.h
 #include asm/arch/bast-irq.h
 
+#define DRV_NAME bast-ide
+
 static int __init bastide_register(unsigned int base, unsigned int aux, int 
irq)
 {
ide_hwif_t *hwif;
@@ -53,6 +55,7 @@ static int __init bastide_register(unsig
ide_init_port_data(hwif, i);
 
ide_init_port_hw(hwif, hw);
+   hwif-mmio = 1;
hwif-quirkproc = NULL;
 
idx[0] = i;
@@ -64,6 +67,8 @@ out:
 
 static int __init bastide_init(void)
 {
+   unsigned long base = BAST_VA_IDEPRI + BAST_IDE_CS;
+
/* we can treat the VR1000 and the BAST the same */
 
if (!(machine_is_bast() || machine_is_vr1000()))
@@ -71,6 +76,11 @@ static int __init bastide_init(void)
 
printk(BAST: IDE driver, (c) 2003-2004 Simtec Electronics\n);
 
+   if (!request_mem_region(base, 0x40, DRV_NAME)) {
+   printk(KERN_ERR %s: resources busy\n, DRV_NAME);
+   return -EBUSY;
+   }
+
bastide_register(BAST_VA_IDEPRI, BAST_VA_IDEPRIAUX, IRQ_IDE0);
bastide_register(BAST_VA_IDESEC, BAST_VA_IDESECAUX, IRQ_IDE1);
 
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] ide-mpc8xx: fix resources reservation

2008-02-19 Thread Bartlomiej Zolnierkiewicz
* Tell IDE layer to not manage resources by setting
  hwif-mmio flag and request resources in m8xx_ide_init_ports().

* Use request_mem_region() for resources reservation.

* Use driver name for resources reservation.

Cc: Vitaly Bordug [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ppc/mpc8xx.c |   18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

Index: b/drivers/ide/ppc/mpc8xx.c
===
--- a/drivers/ide/ppc/mpc8xx.c
+++ b/drivers/ide/ppc/mpc8xx.c
@@ -36,6 +36,8 @@
 #include asm/machdep.h
 #include asm/irq.h
 
+#define DRV_NAME ide-mpc8xx
+
 static int identify  (volatile u8 *p);
 static void print_fixed (volatile u8 *p);
 static void print_funcid (int func);
@@ -182,6 +184,13 @@ static int __init m8xx_ide_init_ports(hw
pcmcia_phy_base, pcmcia_phy_end,
pcmcia_phy_end - pcmcia_phy_base);
 
+   if (!request_mem_region(pcmcia_phy_base,
+   pcmcia_phy_end - pcmcia_phy_base,
+   DRV_NAME)) {
+   printk(KERN_ERR %s: resources busy\n, DRV_NAME);
+   return -EBUSY;
+   }
+
pcmcia_base=(unsigned long)ioremap(pcmcia_phy_base,
   
pcmcia_phy_end-pcmcia_phy_base);
 
@@ -326,7 +335,12 @@ static int __init m8xx_ide_init_ports(hw
printk (IDE phys mem : %08x...%08x (size %08x)\n,
ide_phy_base, ide_phy_end,
ide_phy_end - ide_phy_base);
-   
+
+   if (!request_mem_region(ide_phy_base, 0x200, DRV_NAME)) {
+   printk(KERN_ERR %s: resources busy\n, DRV_NAME);
+   return -EBUSY;
+   }
+
ide_base=(unsigned long)ioremap(ide_phy_base,
ide_phy_end-ide_phy_base);
 
@@ -796,6 +810,7 @@ static int __init mpc8xx_ide_probe(void)
ide_hwif_t *hwif = ide_hwifs[0];
 
ide_init_port_hw(hwif, hw);
+   hwif-mmio = 1;
hwif-pio_mask = ATA_PIO4;
hwif-set_pio_mode = m8xx_ide_set_pio_mode;
 
@@ -807,6 +822,7 @@ static int __init mpc8xx_ide_probe(void)
ide_hwif_t *mate = ide_hwifs[1];
 
ide_init_port_hw(mate, hw);
+   mate-mmio = 1;
mate-pio_mask = ATA_PIO4;
mate-set_pio_mode = m8xx_ide_set_pio_mode;
 
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] falconide: fix resources reservation

2008-02-19 Thread Bartlomiej Zolnierkiewicz
* Tell IDE layer to not manage resources by setting
  hwif-mmio flag and request resources in falconide_init().

* Use request_mem_region() for resources reservation.

* Use driver name for resources reservation.

Cc: Geert Uytterhoeven [EMAIL PROTECTED]
Cc: Michael Schmitz [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/legacy/falconide.c |7 +++
 1 file changed, 7 insertions(+)

Index: b/drivers/ide/legacy/falconide.c
===
--- a/drivers/ide/legacy/falconide.c
+++ b/drivers/ide/legacy/falconide.c
@@ -22,6 +22,7 @@
 #include asm/atariints.h
 #include asm/atari_stdma.h
 
+#define DRV_NAME falconide
 
 /*
  *  Base of the IDE interface
@@ -74,6 +75,11 @@ static int __init falconide_init(void)
 
printk(KERN_INFO ide: Falcon IDE controller\n);
 
+   if (!request_mem_region(ATA_HD_BASE, 0x40, DRV_NAME)) {
+   printk(KERN_ERR %s: resources busy\n);
+   return -EBUSY;
+   }
+
falconide_setup_ports(hw);
 
hwif = ide_find_port();
@@ -83,6 +89,7 @@ static int __init falconide_init(void)
 
ide_init_port_data(hwif, index);
ide_init_port_hw(hwif, hw);
+   hwif-mmio = 1;
 
ide_get_lock(NULL, NULL);
ide_device_add(idx, NULL);
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/5] ide: remove PIO downgrade quirk

2008-02-18 Thread Bartlomiej Zolnierkiewicz
Hi Sergei,

On Feb 18, 2008 5:06 PM, Sergei Shtylyov [EMAIL PROTECTED] wrote:
 Bartlomiej Zolnierkiewicz wrote:

  No need for it nowadays

 Since which moment, could you elaborate

We fixed:

- PIO auto-tuning in core code

- PIO programming in host drivers

- IORDY handling in core code and in host drivers (it could be that the
  incorrect IORDY handling was the main reason behind the downgrade)

and

- lack of corresponding quirk in libata hasn't been problematic so far

so IMO there is no longer a valid reason to punish PIO performance
and the said quirk should be removed (in 2.6.26 after long time in -mm).

  so remove quirk code from ide_get_best_pio_mode()
  and IDE_HFLAG_PIO_DOWNGRADE host flag.

  Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] next-20080218 build failure at pmac_ide_macio_attach ()

2008-02-18 Thread Bartlomiej Zolnierkiewicz
On Monday 18 February 2008, Kamalesh Babulal wrote:
 Hi,
 
 The next-20080218 kernel build fails on the powerpc(s)
 
 drivers/ide/ppc/pmac.c: In function ‘pmac_ide_macio_attach’:
 drivers/ide/ppc/pmac.c:1094: error: conversion to non-scalar type requested
 drivers/ide/ppc/pmac.c: In function ‘pmac_ide_pci_attach’:
 drivers/ide/ppc/pmac.c:1232: error: conversion to non-scalar type requested
 make[3]: *** [drivers/ide/ppc/pmac.o] Error 1
 make[2]: *** [drivers/ide/ppc] Error 2
 make[1]: *** [drivers/ide] Error 2
 make: *** [drivers] Error 2
 
 I Have tested this patch for build failure only.
 
 Signed-off-by: Kamalesh Babulal [EMAIL PROTECTED]
 ---
 --- linux-2.6.25-rc1/drivers/ide/ppc/pmac.c   2008-02-18 18:41:48.0 
 +0530
 +++ linux-2.6.25-rc1/drivers/ide/ppc/~pmac.c  2008-02-18 19:20:37.0 
 +0530
 @@ -1091,7 +1091,7 @@ pmac_ide_macio_attach(struct macio_dev *
   int irq, rc;
   hw_regs_t hw;
  
 - pmif = (struct pmac_ide_hwif)kzalloc(sizeof(*pmif), GFP_KERNEL);
 + pmif = (struct pmac_ide_hwif*)kzalloc(sizeof(*pmif), GFP_KERNEL);
   if (pmif == NULL)
   return -ENOMEM;
  
 @@ -1229,7 +1229,7 @@ pmac_ide_pci_attach(struct pci_dev *pdev
   return -ENODEV;
   }
  
 - pmif = (struct pmac_ide_hwif)kzalloc(sizeof(*pmif), GFP_KERNEL);
 + pmif = (struct pmac_ide_hwif*)kzalloc(sizeof(*pmif), GFP_KERNEL);
   if (pmif == NULL)
   return -ENOMEM;
  

Thanks, I integrated it with the guilty patch to preserve bisectability.

From: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
Subject: [PATCH] ide-pmac: dynamically allocate struct pmac_ide_hwif instances 
(take 2)

* Dynamically allocate struct pmac_ide_hwif instances in pmac_ide_macio_attach()
  and pmac_ide_pci_attach(), then remove no longer needed pmac_ide[].

v2:
* Build fix from Kamalesh Babulal.

Cc: Benjamin Herrenschmidt [EMAIL PROTECTED]
Cc: Kamalesh Babulal [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ppc/pmac.c |   49 +
 1 file changed, 33 insertions(+), 16 deletions(-)

Index: b/drivers/ide/ppc/pmac.c
===
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -79,8 +79,6 @@ typedef struct pmac_ide_hwif {

 } pmac_ide_hwif_t;
 
-static pmac_ide_hwif_t pmac_ide[MAX_HWIFS];
-
 enum {
controller_ohare,   /* OHare based */
controller_heathrow,/* Heathrow/Paddington */
@@ -1094,29 +1092,34 @@ pmac_ide_macio_attach(struct macio_dev *
int i, rc;
hw_regs_t hw;
 
+   pmif = kzalloc(sizeof(*pmif), GFP_KERNEL);
+   if (pmif == NULL)
+   return -ENOMEM;
+
i = 0;
-   while (i  MAX_HWIFS  (ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0
-   || pmac_ide[i].node != NULL))
+   while (i  MAX_HWIFS  (ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0))
++i;
if (i = MAX_HWIFS) {
printk(KERN_ERR ide-pmac: MacIO interface attach with no 
slot\n);
printk(KERN_ERR   %s\n, mdev-ofdev.node-full_name);
-   return -ENODEV;
+   rc = -ENODEV;
+   goto out_free_pmif;
}
 
-   pmif = pmac_ide[i];
hwif = ide_hwifs[i];
 
if (macio_resource_count(mdev) == 0) {
printk(KERN_WARNING ide%d: no address for %s\n,
   i, mdev-ofdev.node-full_name);
-   return -ENXIO;
+   rc = -ENXIO;
+   goto out_free_pmif;
}
 
/* Request memory resource for IO ports */
if (macio_request_resource(mdev, 0, ide-pmac (ports))) {
printk(KERN_ERR ide%d: can't request mmio resource !\n, i);
-   return -EBUSY;
+   rc = -EBUSY;
+   goto out_free_pmif;
}

/* XXX This is bogus. Should be fixed in the registry by checking
@@ -1166,11 +1169,15 @@ pmac_ide_macio_attach(struct macio_dev *
iounmap(pmif-dma_regs);
macio_release_resource(mdev, 1);
}
-   memset(pmif, 0, sizeof(*pmif));
macio_release_resource(mdev, 0);
+   kfree(pmif);
}
 
return rc;
+
+out_free_pmif:
+   kfree(pmif);
+   return rc;
 }
 
 static int
@@ -1223,30 +1230,36 @@ pmac_ide_pci_attach(struct pci_dev *pdev
printk(KERN_ERR ide-pmac: cannot find MacIO node for Kauai ATA 
interface\n);
return -ENODEV;
}
+
+   pmif = kzalloc(sizeof(*pmif), GFP_KERNEL);
+   if (pmif == NULL)
+   return -ENOMEM;
+
i = 0;
-   while (i  MAX_HWIFS  (ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0
-   || pmac_ide[i].node != NULL))
+   while (i  MAX_HWIFS  (ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0))
++i;
if (i = MAX_HWIFS

Re: Optiarc DVD RW AD-5200A audio playing

2008-02-18 Thread Bartlomiej Zolnierkiewicz
On Monday 18 February 2008, Stefan Bader wrote:
 Borislav Petkov wrote:
  On Sat, Feb 16, 2008 at 04:24:01PM +0100, Bartlomiej Zolnierkiewicz wrote:
  Hi,
 
  On Saturday 16 February 2008, Borislav Petkov wrote:
  On Fri, Feb 15, 2008 at 02:53:27PM -0500, Stefan Bader wrote:
  Hello Borislav,
 
  I worked on a problem with an DVD driver (model=Optiarc DVD RW AD-5200A)
  which obviously has the same problem as some Matshita drives. The
  following patch was reported to enabled audio playing on this drive.
  Would this approach be suitable for upstream or are there other
  solutions to this problem?
 
  Regards,
  Stefan
 
  --- a/drivers/ide/ide-cd.c
  +++ b/drivers/ide/ide-cd.c
  @@ -2988,7 +2988,8 @@ int ide_cdrom_probe_capabilities (ide_drive_t 
  *drive)
   if (strcmp(drive-id-model, MATSHITADVD-ROM SR-8187) == 0 ||
   strcmp(drive-id-model, MATSHITADVD-ROM SR-8186) == 0 ||
   strcmp(drive-id-model, MATSHITADVD-ROM SR-8176) == 0 ||
  -strcmp(drive-id-model, MATSHITADVD-ROM SR-8174) == 0)
  +strcmp(drive-id-model, MATSHITADVD-ROM SR-8174) == 0 ||
  +strcmp(drive-id-model, Optiarc DVD RW AD-5200A) == 0)
   CDROM_CONFIG_FLAGS(drive)-audio_play = 1;
 
   #if ! STANDARD_ATAPI
  Hi Stefan,
 
  just to make sure that the audioplay bit is not set in the capabilities 
  page,
  can you please try the following patch applied against 2.6.25-rc2 and 
  send me
  the output. Thanks!
 
  @Bart: by the way, this cdi-mask thingy is kinda unintuitive doing double
  negation to check whether a feature is supported or not. Yeah, this comes 
  from
  above, i.e. uniform cdrom layer. But still, shouldn't we use a 
  cdi-caps_flags
  or something similar instead, which mirrors the caps page bits setting?
  It seems so (at least having negative flags is very unintuitive) but they
  might be some reason for this ugliness, Jens?
 
  [ Please also remember that since cdrom layer is _uniform_ it may be not
possible and/or desirable to have 1-1 mapping between caps page bits
and the future cdi-caps_flags. ]
 
  commit 435f0f4496a1b32af2d542f43b2370a890fe2f83
  Author: Borislav Petkov [EMAIL PROTECTED]
  Date:   Sat Feb 16 09:56:36 2008 +0100
 
  ide-cd: Enable audio play quirk for Optiarc DVD RW AD-5200A drive
  
  Reported-by: Stefan Bader [EMAIL PROTECTED]
  Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
 
  diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
  index f77db6b..2c9d06e 100644
  --- a/drivers/ide/ide-cd.c
  +++ b/drivers/ide/ide-cd.c
  @@ -1750,6 +1750,10 @@ int ide_cdrom_probe_capabilities (ide_drive_t 
  *drive)
cdi-mask = ~(CDC_DVD_RAM | CDC_RAM);
if (buf[8 + 3]  0x10)
cdi-mask = ~CDC_DVD_R;
  + if (!(buf[8 + 4]  0x01)) {
  Hmm, shouldn't there be ' (cd-cd_flags  IDE_CD_FLAG_PLAY_AUDIO_OK)'
  to prevent false positives?
  
  I wanted to see whether the caps page reports the audioplay bit off...
  
  + printk(KERN_INFO ide-cd: audio play not advertised in caps 
  page,
  Would be nice to also printk() the device name.
  
  ... but printing the device model is actually a good idea and this will 
  rule out
  false positives, so Stefan, please drop the previous patch and test the 
  updated
  one below. Thanks.
  
  
 
 Hi Borislav,
 
 the problem is that I don't own this drive myself and the owner is
 running a 2.6.22 kernel and is normally not doing any kernel compiles.
 But I could provide him a modified patch.
 Though, if you just want to know whether the cap bit was really unset, I
 think we know this already. When I got the problem report we checked
 /proc/sys/dev/cdrom/info and that showed the Can play audio bit as 0.
 Which is the reason I gave the owner the patch for adding the model to
 the excemption list. And from his feedback I take that the drive plays
 audio tracks with the patch in use.

Borislav, I guess that this is good enough proof that audioplay bit is off.

Could you please send me the final version of the patch?

 Stefan
 
  commit 6cc44b0ce5c9270b15d456eb9ffa91b855e4e0d0
  Author: Borislav Petkov [EMAIL PROTECTED]
  Date:   Sat Feb 16 09:56:36 2008 +0100
  
  ide-cd: Enable audio play quirk for Optiarc DVD RW AD-5200A drive
  
  Reported-by: Stefan Bader [EMAIL PROTECTED]
  Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
  
  diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
  index f77db6b..4c9984f 100644
  --- a/drivers/ide/ide-cd.c
  +++ b/drivers/ide/ide-cd.c
  @@ -1750,6 +1750,11 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
  cdi-mask = ~(CDC_DVD_RAM | CDC_RAM);
  if (buf[8 + 3]  0x10)
  cdi-mask = ~CDC_DVD_R;
  +   if (!(buf[8 + 4]  0x01)) {
  +   printk(KERN_INFO ide-cd: audio play not advertised in caps 
  +   page for drive model [%s], enabling quirk.\n,
  +   drive-id-model);
  +   }
  if ((buf[8 + 4]  0x01

Re: [PATCH ht6560b] Force prefetch for some devices

2008-02-18 Thread Bartlomiej Zolnierkiewicz
On Monday 18 February 2008, Jan Evert van Grootheest wrote:
 Prefetch needs to be set for some ide devices to work when connected to
 a ht6560b interface. This was not always done properly, causing a system
 with a HD and CD on the primary interface to not work properly. Or, in
 effect, hang hard.
 
 This patch forces prefetch on devices before checking whether it
 is necessary to change the settings in the interface
 
 This patch should also be applied to 2.4. I don't currently have a
 2.4 tree around.
 
 (also change my email address)
 
 Signed-off-by: Jan Evert van Grootheest [EMAIL PROTECTED]

I applied it as it is but could I ask you to follow up on the following
(rather minor) issues:

- According to observations from your testing and comments from Sergei/Alan
  it really seems that prefetch bit has reversed meaning so the driver should
  be updated to reflect it.

- Could the old changelog be removed while we are at it?  The detailed
  changelog is kept in the kernel git tree nowadays.

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ht6560b can only do up to PIO mode 4

2008-02-18 Thread Bartlomiej Zolnierkiewicz
On Monday 18 February 2008, Jan Evert van Grootheest wrote:
 According to the datasheet, ht6560b only supports up to PIO mode 4.
 
 Signed-off-by: Jan Evert van Grootheest [EMAIL PROTECTED]

applied, thanks!

PS I had to manually port it over 2.6.25-rc2, patch below

From: Jan Evert van Grootheest [EMAIL PROTECTED]
Subject: [PATCH] ht6560b can only do up to PIO mode 4

According to the datasheet, ht6560b only supports up to PIO mode 4.

[bart: manually ported it over 2.6.25-rc2]

Signed-off-by: Jan Evert van Grootheest [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/legacy/ht6560b.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/drivers/ide/legacy/ht6560b.c
===
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -323,7 +323,7 @@ static const struct ide_port_info ht6560
  IDE_HFLAG_NO_DMA |
  IDE_HFLAG_NO_AUTOTUNE |
  IDE_HFLAG_ABUSE_PREFETCH,
-   .pio_mask   = ATA_PIO5,
+   .pio_mask   = ATA_PIO4,
 };
 
 static int __init ht6560b_init(void)
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[git patches] IDE fixes

2008-02-18 Thread Bartlomiej Zolnierkiewicz

Hi,

This update fixes all known/open 2.6.25 IDE regressions + few other things:

- fix ide-cd cd/dvd burning regression (Kiyoshi Ueda)

- fix falconide/macide regressions (Geert Uytterhoeven)

- another device needs HPA workaround (Mikko Rapeli)

- ht6560b bugfixes (Jan Evert van Grootheest)

- new PCI id (used by Everex Cloudbook) for via82cxxx (Andrew Smith)


Linus, please pull from:

master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6.git/

to receive the following updates:

 MAINTAINERS|2 +-
 drivers/ata/libata-core.c  |1 +
 drivers/ide/ide-cd.c   |6 +-
 drivers/ide/ide-disk.c |1 +
 drivers/ide/ide-generic.c  |6 --
 drivers/ide/legacy/falconide.c |4 +++-
 drivers/ide/legacy/ht6560b.c   |   25 +
 drivers/ide/legacy/macide.c|2 +-
 drivers/ide/pci/via82cxxx.c|1 +
 include/linux/Kbuild   |2 +-
 include/linux/hdsmart.h|4 ++--
 include/linux/pci_ids.h|1 +
 12 files changed, 34 insertions(+), 21 deletions(-)


Andrew Smith (1):
  via82cxxx: add new PCI id for cx700

Bartlomiej Zolnierkiewicz (2):
  falconide: locking bugfix
  linux/hdsmart.h: fix goofups (take 2)

Borislav Petkov (1):
  MAINTAINERS: update ide-cd maintainer's email address

Geert Uytterhoeven (1):
  ide: Add missing base addresses for falconide and macide

Jan Evert van Grootheest (2):
  ht6560b can only do up to PIO mode 4
  ht6560b: force prefetch for some devices

Kiyoshi Ueda (1):
  ide-cd: fix missing residual count setting in DMA mode

Mikko Rapeli (1):
  ide/libata: ST310211A has buggy HPA too


diff --git a/MAINTAINERS b/MAINTAINERS
index 1d2edb4..082d1ee 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1924,7 +1924,7 @@ S:Maintained
 
 IDE/ATAPI CDROM DRIVER
 P: Borislav Petkov
-M: [EMAIL PROTECTED]
+M: [EMAIL PROTECTED]
 L: linux-ide@vger.kernel.org
 S: Maintained
 
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index beaa3a9..f46eb6f 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4190,6 +4190,7 @@ static const struct ata_blacklist_entry 
ata_device_blacklist [] = {
/* Devices which report 1 sector over size HPA */
{ ST340823A,  NULL,   ATA_HORKAGE_HPA_SIZE, },
{ ST320413A,  NULL,   ATA_HORKAGE_HPA_SIZE, },
+   { ST310211A,  NULL,   ATA_HORKAGE_HPA_SIZE, },
 
/* Devices which get the IVB wrong */
{ QUANTUM FIREBALLlct10 05, A03.0900, ATA_HORKAGE_IVB, },
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 354c91d..310e497 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1207,9 +1207,13 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t 
*drive)
 end_request:
if (blk_pc_request(rq)) {
unsigned long flags;
+   unsigned int dlen = rq-data_len;
+
+   if (dma)
+   rq-data_len = 0;
 
spin_lock_irqsave(ide_lock, flags);
-   if (__blk_end_request(rq, 0, rq-data_len))
+   if (__blk_end_request(rq, 0, dlen))
BUG();
HWGROUP(drive)-rq = NULL;
spin_unlock_irqrestore(ide_lock, flags);
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index aed8b31..8f5bed4 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -397,6 +397,7 @@ static inline int idedisk_supports_lba48(const struct 
hd_driveid *id)
 static const struct drive_list_entry hpa_list[] = {
{ ST340823A,  NULL },
{ ST320413A,  NULL },
+   { ST310211A,  NULL },
{ NULL, NULL }
 };
 
diff --git a/drivers/ide/ide-generic.c b/drivers/ide/ide-generic.c
index 709b9e4..9ebec08 100644
--- a/drivers/ide/ide-generic.c
+++ b/drivers/ide/ide-generic.c
@@ -17,9 +17,6 @@ static int __init ide_generic_init(void)
u8 idx[MAX_HWIFS];
int i;
 
-   if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET])
-   ide_get_lock(NULL, NULL); /* for atari only */
-
for (i = 0; i  MAX_HWIFS; i++) {
ide_hwif_t *hwif = ide_hwifs[i];
 
@@ -31,9 +28,6 @@ static int __init ide_generic_init(void)
 
ide_device_add_all(idx, NULL);
 
-   if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET])
-   ide_release_lock(); /* for atari only */
-
return 0;
 }
 
diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c
index f044048..8949ce7 100644
--- a/drivers/ide/legacy/falconide.c
+++ b/drivers/ide/legacy/falconide.c
@@ -54,7 +54,7 @@ static void __init falconide_setup_ports(hw_regs_t *hw)
for (i = 1; i  8; i++)
hw-io_ports[i] = ATA_HD_BASE + 1 + i * 4;
 
-   hw-io_ports[IDE_CONTROL_OFFSET] = ATA_HD_CONTROL;
+   hw-io_ports[IDE_CONTROL_OFFSET] = ATA_HD_BASE + ATA_HD_CONTROL;
 
hw-irq = IRQ_MFP_IDE

[PATCH] falconide: locking bugfix

2008-02-17 Thread Bartlomiej Zolnierkiewicz

commit 8ac4ce742c66100931b6f2d7a36b0df08bc721fe (ide: fix host drivers
depending on ide_generic to probe for interfaces (take 2)) moved probing
to falconide but forgot to take care of Atari specific locking - fix it.

Cc: Geert Uytterhoeven [EMAIL PROTECTED]
Cc: Michael Schmitz [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-generic.c  |6 --
 drivers/ide/legacy/falconide.c |2 ++
 2 files changed, 2 insertions(+), 6 deletions(-)

Index: b/drivers/ide/ide-generic.c
===
--- a/drivers/ide/ide-generic.c
+++ b/drivers/ide/ide-generic.c
@@ -17,9 +17,6 @@ static int __init ide_generic_init(void)
u8 idx[MAX_HWIFS];
int i;
 
-   if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET])
-   ide_get_lock(NULL, NULL); /* for atari only */
-
for (i = 0; i  MAX_HWIFS; i++) {
ide_hwif_t *hwif = ide_hwifs[i];
 
@@ -31,9 +28,6 @@ static int __init ide_generic_init(void)
 
ide_device_add_all(idx, NULL);
 
-   if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET])
-   ide_release_lock(); /* for atari only */
-
return 0;
 }
 
Index: b/drivers/ide/legacy/falconide.c
===
--- a/drivers/ide/legacy/falconide.c
+++ b/drivers/ide/legacy/falconide.c
@@ -84,7 +84,9 @@ static int __init falconide_init(void)
ide_init_port_data(hwif, index);
ide_init_port_hw(hwif, hw);
 
+   ide_get_lock(NULL, NULL);
ide_device_add(idx, NULL);
+   ide_release_lock();
}
 
return 0;
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: PROBLEM: Corruption problems in pata_via for Via NanoBook owners (Cloudbook, EasyNote XS etc.)

2008-02-17 Thread Bartlomiej Zolnierkiewicz

Hi,

On Sunday 17 February 2008, Andrew Smith wrote:
 One Line : Changes in 2.24 have rendered the ide handling on the Via  
 NanoBook unstable resulting in data loss under heavy load.
 
 Keywords : modules, pata_via, viac82
 
 Kernel version : 2.24
 
 Environment : Packard Bell Easynote XS - based on Via Nanobook  
 reference platform. (same as Everex Cloudbook in the USA).
 
 Detail:
 
 In v2.23 Kernel the following patch could be applied to viac82  
 (see end of document), this works stably.
 
 In 2.24 the device ID 0x581 for Vendor VIA was added to the pata_via  
 driver causing some problems.
 
 It builds fine and seems to start up OK, however, on large IOs then  
 the kernel starts to throw errors about MULTICMDs (I think that was  
 the term) returning an invalid response.
 
 I have lost 2 builds so far (disk corruption) and have reverted to  
 2.23 with the attached patch which does work fine (and gives UDMA133).
 
 Suggestions:
 
 Re-implement 0x581 handling in via82 based on patch shown below.

Thank you for reporting it (I was unaware that via82cxxx misses some ids).

I ported your patch over 2.6.25-rc2 and merged it.

 Drop 0x581 support from pata_ide unless it is known to work with other  
 hardware variants reliably.

Added Jeff/Alan to cc: so they can follow up on this.

 If 0x581 is more desirable in pata_ide then make the via82c and  
 pata_ide drivers mutually exclusive in a kernel configuration.
 
 
 Regards,
 
 -Andy Smith
 
 *** linux-2.6.23/drivers/ide/pci/via82cxxx.c  2007-10-09  
 22:31:38.0 +0200
 --- linux-2.6.23-via-patch/drivers/ide/pci/via82cxxx.c2007-11-02  
 01:03:57.0 +0100
 ***
 *** 61,66 
 --- 61,68 
#define VIA_NO_UNMASK  0x08 /* Doesn't work with IRQ unmasking 
 on */
#define VIA_BAD_ID 0x10 /* Has wrong vendor ID (0x1107) */
#define VIA_BAD_AST0x20 /* Don't touch Address Setup 
 Timing */
 + #define PCI_DEVICE_ID_VIA_CX700 0x8324
 + #define PCI_DEVICE_ID_VIA_CX700_IDE 0x0581
 
/*
 * VIA SouthBridge chips.
 ***
 *** 545,550 
 --- 547,553 
   { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C576_1, PCI_ANY_ID,  
 PCI_ANY_ID, 0, 0, 0},
   { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, PCI_ANY_ID,  
 PCI_ANY_ID, 0, 0, 0},
   { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_6410, PCI_ANY_ID,  
 PCI_ANY_ID, 0, 0, 1},
 + { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_CX700_IDE, PCI_ANY_ID,  
 PCI_ANY_ID, 0, 0, 0},
   { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_SATA_EIDE, PCI_ANY_ID,  
 PCI_ANY_ID, 0, 0, 1},
   { 0, },
};

2.6.25-rc2 version:

From: Andrew Smith [EMAIL PROTECTED]
Subject: [PATCH] via82cxxx: add new PCI id for cx700

[bart: manually ported it over via82cxxx changes]

From: Andrew Smith [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/pci/via82cxxx.c |1 +
 include/linux/pci_ids.h |1 +
 2 files changed, 2 insertions(+)

Index: b/drivers/ide/pci/via82cxxx.c
===
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -479,6 +479,7 @@ static int __devinit via_init_one(struct
 static const struct pci_device_id via_pci_tbl[] = {
{ PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C576_1),  0 },
{ PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C586_1),  0 },
+   { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_CX700_IDE), 0 },
{ PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_6410),  1 },
{ PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_SATA_EIDE), 1 },
{ 0, },
Index: b/include/linux/pci_ids.h
===
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1351,6 +1351,7 @@
 #define PCI_DEVICE_ID_VIA_8231_4   0x8235
 #define PCI_DEVICE_ID_VIA_8365_1   0x8305
 #define PCI_DEVICE_ID_VIA_CX7000x8324
+#define PCI_DEVICE_ID_VIA_CX700_IDE0x0581
 #define PCI_DEVICE_ID_VIA_VX8000x8353
 #define PCI_DEVICE_ID_VIA_8371_1   0x8391
 #define PCI_DEVICE_ID_VIA_82C598_1 0x8598
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 03/12] ide: add ide-4drives host driver

2008-02-17 Thread Bartlomiej Zolnierkiewicz
On Saturday 16 February 2008, Randy Dunlap wrote:

[...]

  +You also need to use probe kernel paramater for ide-4drives driver
 
parameter

thanks, fixed in take 2
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/4] : More use DIV_ROUND_UP

2008-02-17 Thread Bartlomiej Zolnierkiewicz
On Saturday 16 February 2008, Julia Lawall wrote:
 From: Julia Lawall [EMAIL PROTECTED]
 
 The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /
 (d)) but is perhaps more readable.
 
 An extract of the semantic patch that makes this change is as follows:
 (http://www.emn.fr/x-info/coccinelle/)
 
 // smpl
 @haskernel@
 @@
 
 #include linux/kernel.h
 
 @depends on haskernel@
 expression n,d;
 @@
 
 (
 - (n + d - 1) / d
 + DIV_ROUND_UP(n,d)
 |
 - (n + (d - 1)) / d
 + DIV_ROUND_UP(n,d)
 )
 
 @depends on haskernel@
 expression n,d;
 @@
 
 - DIV_ROUND_UP((n),d)
 + DIV_ROUND_UP(n,d)
 
 @depends on haskernel@
 expression n,d;
 @@
 
 - DIV_ROUND_UP(n,(d))
 + DIV_ROUND_UP(n,d)
 // /smpl
 
 Signed-off-by: Julia Lawall [EMAIL PROTECTED]

applied, thanks
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/5] ide: remove PIO downgrade quirk

2008-02-17 Thread Bartlomiej Zolnierkiewicz
No need for it nowadays so remove quirk code from ide_get_best_pio_mode()
and IDE_HFLAG_PIO_DOWNGRADE host flag.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-lib.c   |   10 --
 drivers/ide/pci/amd74xx.c   |1 -
 drivers/ide/pci/via82cxxx.c |1 -
 drivers/ide/ppc/pmac.c  |1 -
 include/linux/ide.h |2 --
 5 files changed, 15 deletions(-)

Index: b/drivers/ide/ide-lib.c
===
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -284,16 +284,6 @@ u8 ide_get_best_pio_mode (ide_drive_t *d
if (overridden)
printk(KERN_INFO %s: tPIO  2, assuming tPIO = 2\n,
 drive-name);
-
-   /*
-* Conservative downgrade for all pre-ATA2 drives
-*/
-   if ((drive-hwif-host_flags  IDE_HFLAG_PIO_NO_DOWNGRADE) == 0 

-   pio_mode  pio_mode  4) {
-   pio_mode--;
-   printk(KERN_INFO %s: applying conservative 
-PIO \downgrade\\n, drive-name);
-   }
}
 
if (pio_mode  max_mode)
Index: b/drivers/ide/pci/amd74xx.c
===
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -219,7 +219,6 @@ static void __devinit init_hwif_amd74xx(
 
 #define IDE_HFLAGS_AMD \
(IDE_HFLAG_PIO_NO_BLACKLIST | \
-IDE_HFLAG_PIO_NO_DOWNGRADE | \
 IDE_HFLAG_ABUSE_SET_DMA_MODE | \
 IDE_HFLAG_POST_SET_MODE | \
 IDE_HFLAG_IO_32BIT | \
Index: b/drivers/ide/pci/via82cxxx.c
===
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -429,7 +429,6 @@ static const struct ide_port_info via82c
.init_hwif  = init_hwif_via82cxxx,
.enablebits = { { 0x40, 0x02, 0x02 }, { 0x40, 0x01, 0x01 } },
.host_flags = IDE_HFLAG_PIO_NO_BLACKLIST |
- IDE_HFLAG_PIO_NO_DOWNGRADE |
  IDE_HFLAG_ABUSE_SET_DMA_MODE |
  IDE_HFLAG_POST_SET_MODE |
  IDE_HFLAG_IO_32BIT,
Index: b/drivers/ide/ppc/pmac.c
===
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -921,7 +921,6 @@ pmac_ide_do_resume(ide_hwif_t *hwif)
 static const struct ide_port_info pmac_port_info = {
.chipset= ide_pmac,
.host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA |
- IDE_HFLAG_PIO_NO_DOWNGRADE |
  IDE_HFLAG_POST_SET_MODE |
  IDE_HFLAG_NO_DMA | /* no SFF-style DMA */
  IDE_HFLAG_UNMASK_IRQS,
Index: b/include/linux/ide.h
===
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1031,8 +1031,6 @@ enum {
IDE_HFLAG_SINGLE= (1  1),
/* don't use legacy PIO blacklist */
IDE_HFLAG_PIO_NO_BLACKLIST  = (1  2),
-   /* don't use conservative PIO downgrade */
-   IDE_HFLAG_PIO_NO_DOWNGRADE  = (1  3),
/* use PIO8/9 for prefetch off/on */
IDE_HFLAG_ABUSE_PREFETCH= (1  4),
/* use PIO6/7 for fast-devsel off/on */
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/5] ide: merge ide_match_hwif() and ide_find_port()

2008-02-17 Thread Bartlomiej Zolnierkiewicz
* Change ide_match_hwif() argument from 'u8 bootable' to
  'struct ide_port_info *d'.

* Move ide_match_hwif() to ide-probe.c from setup-pci.c and rename
  it to ide_find_port_slot().  Update some comments while at it.

* ide_find_port() can be now just a wrapper for ide_find_port_slot().

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-probe.c |   46 ++
 drivers/ide/ide.c   |   15 ---
 drivers/ide/setup-pci.c |   48 +---
 include/linux/ide.h |8 +++-
 4 files changed, 54 insertions(+), 63 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1435,6 +1435,52 @@ static int ide_sysfs_register_port(ide_h
return rc;
 }
 
+/**
+ * ide_find_port_slot  -   find free ide_hwifs[] slot
+ * @d: IDE port info
+ *
+ * Return the new hwif.  If we are out of free slots return NULL.
+ */
+
+ide_hwif_t *ide_find_port_slot(const struct ide_port_info *d)
+{
+   ide_hwif_t *hwif;
+   int i;
+   u8 bootable = (d  (d-host_flags  IDE_HFLAG_NON_BOOTABLE)) ? 0 : 1;
+
+   /*
+* Claim an unassigned slot.
+*
+* Give preference to claiming other slots before claiming ide0/ide1,
+* just in case there's another interface yet-to-be-scanned
+* which uses ports 0x1f0/0x170 (the ide0/ide1 defaults).
+*
+* Unless there is a bootable card that does not use the standard
+* ports 0x1f0/0x170 (the ide0/ide1 defaults).
+*/
+   if (bootable) {
+   for (i = 0; i  MAX_HWIFS; i++) {
+   hwif = ide_hwifs[i];
+   if (hwif-chipset == ide_unknown)
+   return hwif;
+   }
+   } else {
+   for (i = 2; i  MAX_HWIFS; i++) {
+   hwif = ide_hwifs[i];
+   if (hwif-chipset == ide_unknown)
+   return hwif;
+   }
+   for (i = 0; i  2  i  MAX_HWIFS; i++) {
+   hwif = ide_hwifs[i];
+   if (hwif-chipset == ide_unknown)
+   return hwif;
+   }
+   }
+
+   return NULL;
+}
+EXPORT_SYMBOL_GPL(ide_find_port_slot);
+
 int ide_device_add_all(u8 *idx, const struct ide_port_info *d)
 {
ide_hwif_t *hwif, *mate = NULL;
Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -234,21 +234,6 @@ static int ide_system_bus_speed(void)
return pci_dev_present(pci_default) ? 33 : 50;
 }
 
-ide_hwif_t *ide_find_port(void)
-{
-   ide_hwif_t *hwif;
-   int i;
-
-   for (i = 0; i  MAX_HWIFS; i++) {
-   hwif = ide_hwifs[i];
-   if (hwif-chipset == ide_unknown)
-   return hwif;
-   }
-
-   return NULL;
-}
-EXPORT_SYMBOL_GPL(ide_find_port);
-
 static struct resource* hwif_request_region(ide_hwif_t *hwif,
unsigned long addr, int num)
 {
Index: b/drivers/ide/setup-pci.c
===
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -20,51 +20,6 @@
 #include asm/io.h
 #include asm/irq.h
 
-
-/**
- * ide_match_hwif  -   find free ide_hwifs[] slot
- * @bootable: bootable flag
- *
- * Return the new hwif.  If we are out of free slots return NULL.
- */
-
-static ide_hwif_t *ide_match_hwif(u8 bootable)
-{
-   ide_hwif_t *hwif;
-   int h;
-
-   /*
-* Claim an unassigned slot.
-*
-* Give preference to claiming other slots before claiming ide0/ide1,
-* just in case there's another interface yet-to-be-scanned
-* which uses ports 1f0/170 (the ide0/ide1 defaults).
-*
-* Unless there is a bootable card that does not use the standard
-* ports 1f0/170 (the ide0/ide1 defaults). The (bootable) flag.
-*/
-   if (bootable) {
-   for (h = 0; h  MAX_HWIFS; ++h) {
-   hwif = ide_hwifs[h];
-   if (hwif-chipset == ide_unknown)
-   return hwif;/* pick an unused entry */
-   }
-   } else {
-   for (h = 2; h  MAX_HWIFS; ++h) {
-   hwif = ide_hwifs + h;
-   if (hwif-chipset == ide_unknown)
-   return hwif;/* pick an unused entry */
-   }
-   }
-   for (h = 0; h  2  h  MAX_HWIFS; ++h) {
-   hwif = ide_hwifs + h;
-   if (hwif-chipset == ide_unknown)
-   return hwif;/* pick

[PATCH 5/5] ide: unexport ide_hwifs[]

2008-02-17 Thread Bartlomiej Zolnierkiewicz
All modular users have been fixed to not reference ide_hwifs[] directly.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide.c |5 -
 1 file changed, 5 deletions(-)

Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -102,13 +102,8 @@ int ide_noacpitfs = 1;
 int ide_noacpionboot = 1;
 #endif
 
-/*
- * This is declared extern in ide.h, for access by other IDE modules:
- */
 ide_hwif_t ide_hwifs[MAX_HWIFS];   /* master data repository */
 
-EXPORT_SYMBOL(ide_hwifs);
-
 static void ide_port_init_devices_data(ide_hwif_t *);
 
 /*
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/5] ide: use ide_find_port() in legacy VLB host drivers

2008-02-17 Thread Bartlomiej Zolnierkiewicz
* Add IDE_HFLAG_QD_2ND_PORT host flag to indicate the need of skipping
  first ide_hwifs[] slot for the second port of QD65xx controller.

* Handle this new host flag in ide_find_port_slot().

* Convert legacy VLB host drivers to use ide_find_port().

While at it:

* Fix couple of printk()-s in qd65xx host driver to not use hwif-name.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-probe.c  |4 +-
 drivers/ide/legacy/ali14xx.c |   19 ---
 drivers/ide/legacy/dtc2278.c |   22 +++--
 drivers/ide/legacy/ht6560b.c |   31 ++
 drivers/ide/legacy/ide-4drives.c |   34 +++-
 drivers/ide/legacy/qd65xx.c  |   66 +--
 drivers/ide/legacy/umc8672.c |   19 ---
 include/linux/ide.h  |2 +
 8 files changed, 119 insertions(+), 78 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1459,7 +1459,9 @@ ide_hwif_t *ide_find_port_slot(const str
 * ports 0x1f0/0x170 (the ide0/ide1 defaults).
 */
if (bootable) {
-   for (i = 0; i  MAX_HWIFS; i++) {
+   i = (d  (d-host_flags  IDE_HFLAG_QD_2ND_PORT)) ? 1 : 0;
+
+   for (; i  MAX_HWIFS; i++) {
hwif = ide_hwifs[i];
if (hwif-chipset == ide_unknown)
return hwif;
Index: b/drivers/ide/legacy/ali14xx.c
===
--- a/drivers/ide/legacy/ali14xx.c
+++ b/drivers/ide/legacy/ali14xx.c
@@ -199,7 +199,8 @@ static const struct ide_port_info ali14x
 
 static int __init ali14xx_probe(void)
 {
-   static u8 idx[4] = { 0, 1, 0xff, 0xff };
+   ide_hwif_t *hwif, *mate;
+   static u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
hw_regs_t hw[2];
 
printk(KERN_DEBUG ali14xx: base=0x%03x, regOn=0x%02x.\n,
@@ -219,11 +220,19 @@ static int __init ali14xx_probe(void)
ide_std_init_ports(hw[1], 0x170, 0x376);
hw[1].irq = 15;
 
-   ide_init_port_hw(ide_hwifs[0], hw[0]);
-   ide_init_port_hw(ide_hwifs[1], hw[1]);
+   hwif = ide_find_port();
+   if (hwif) {
+   ide_init_port_hw(hwif, hw[0]);
+   hwif-set_pio_mode = ali14xx_set_pio_mode;
+   idx[0] = hwif-index;
+   }
 
-   ide_hwifs[0].set_pio_mode = ali14xx_set_pio_mode;
-   ide_hwifs[1].set_pio_mode = ali14xx_set_pio_mode;
+   mate = ide_find_port();
+   if (mate) {
+   ide_init_port_hw(mate, hw[1]);
+   mate-set_pio_mode = ali14xx_set_pio_mode;
+   idx[1] = mate-index;
+   }
 
ide_device_add(idx, ali14xx_port_info);
 
Index: b/drivers/ide/legacy/dtc2278.c
===
--- a/drivers/ide/legacy/dtc2278.c
+++ b/drivers/ide/legacy/dtc2278.c
@@ -102,15 +102,9 @@ static int __init dtc2278_probe(void)
 {
unsigned long flags;
ide_hwif_t *hwif, *mate;
-   static u8 idx[4] = { 0, 1, 0xff, 0xff };
+   static u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
hw_regs_t hw[2];
 
-   hwif = ide_hwifs[0];
-   mate = ide_hwifs[1];
-
-   if (hwif-chipset != ide_unknown || mate-chipset != ide_unknown)
-   return 1;
-
local_irq_save(flags);
/*
 * This enables the second interface
@@ -137,10 +131,18 @@ static int __init dtc2278_probe(void)
ide_std_init_ports(hw[1], 0x170, 0x376);
hw[1].irq = 15;
 
-   ide_init_port_hw(hwif, hw[0]);
-   ide_init_port_hw(mate, hw[1]);
+   hwif = ide_find_port();
+   if (hwif) {
+   ide_init_port_hw(hwif, hw[0]);
+   hwif-set_pio_mode = dtc2278_set_pio_mode;
+   idx[0] = hwif-index;
+   }
 
-   hwif-set_pio_mode = dtc2278_set_pio_mode;
+   mate = ide_find_port();
+   if (mate) {
+   ide_init_port_hw(mate, hw[1]);
+   idx[1] = mate-index;
+   }
 
ide_device_add(idx, dtc2278_port_info);
 
Index: b/drivers/ide/legacy/ht6560b.c
===
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -331,15 +331,12 @@ static const struct ide_port_info ht6560
 static int __init ht6560b_init(void)
 {
ide_hwif_t *hwif, *mate;
-   static u8 idx[4] = { 0, 1, 0xff, 0xff };
+   static u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
hw_regs_t hw[2];
 
if (probe_ht6560b == 0)
return -ENODEV;
 
-   hwif = ide_hwifs[0];
-   mate = ide_hwifs[1];
-
if (!request_region(HT_CONFIG_PORT, 1, DRV_NAME)) {
printk(KERN_NOTICE %s: HT_CONFIG_PORT not found\n,
__FUNCTION__);
@@ -359,17 +356,23 @@ static int __init ht6560b_init(void

[PATCH 4/5] ide-generic: use ide_find_port()

2008-02-17 Thread Bartlomiej Zolnierkiewicz
There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-generic.c |   17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

Index: b/drivers/ide/ide-generic.c
===
--- a/drivers/ide/ide-generic.c
+++ b/drivers/ide/ide-generic.c
@@ -90,18 +90,27 @@ static int __init ide_generic_init(void)
int i;
 
for (i = 0; i  MAX_HWIFS; i++) {
-   ide_hwif_t *hwif = ide_hwifs[i];
+   ide_hwif_t *hwif;
unsigned long io_addr = ide_default_io_base(i);
hw_regs_t hw;
 
-   if (hwif-chipset == ide_unknown  io_addr) {
-   u8 oldnoprobe = hwif-noprobe;
+   if (io_addr) {
+   u8 oldnoprobe;
+
+   /*
+* Skip probing if the corresponding
+* slot entry is already occupied.
+*/
+   hwif = ide_find_port();
+   if (hwif == NULL || hwif-index != i)
+   continue;
 
memset(hw, 0, sizeof(hw));
ide_std_init_ports(hw, io_addr, io_addr + 0x206);
hw.irq = ide_default_irq(io_addr);
-   ide_init_port_hw(hwif, hw);
 
+   oldnoprobe = hwif-noprobe;
+   ide_init_port_hw(hwif, hw);
hwif-noprobe = oldnoprobe;
 
idx[i] = i;
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] ide-disk: fix issues found by checkpatch.pl

2008-02-17 Thread Bartlomiej Zolnierkiewicz
There are no changes to the resulting drivers/ide/ide-disk.o binary file
(md5sum-s after and before the patch match).

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-disk.c |  120 -
 1 file changed, 70 insertions(+), 50 deletions(-)

Index: b/drivers/ide/ide-disk.c
===
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -16,8 +16,6 @@
 
 #define IDEDISK_VERSION1.18
 
-//#define DEBUG
-
 #include linux/module.h
 #include linux/types.h
 #include linux/string.h
@@ -88,7 +86,7 @@ static void ide_disk_put(struct ide_disk
  *
  * It is called only once for each drive.
  */
-static int lba_capacity_is_ok (struct hd_driveid *id)
+static int lba_capacity_is_ok(struct hd_driveid *id)
 {
unsigned long lba_sects, chs_sects, head, tail;
 
@@ -176,7 +174,8 @@ static void ide_tf_set_cmd(ide_drive_t *
  * __ide_do_rw_disk() issues READ and WRITE commands to a disk,
  * using LBA if supported, or CHS otherwise, to address sectors.
  */
-static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request 
*rq, sector_t block)
+static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
+   sector_t block)
 {
ide_hwif_t *hwif= HWIF(drive);
unsigned int dma= drive-using_dma;
@@ -228,7 +227,8 @@ static ide_startstop_t __ide_do_rw_disk(
tf-device = (block  8)  0xf;
}
} else {
-   unsigned int sect,head,cyl,track;
+   unsigned int sect, head, cyl, track;
+
track = (int)block / drive-sect;
sect  = (int)block % drive-sect + 1;
head  = track % drive-head;
@@ -271,7 +271,8 @@ static ide_startstop_t __ide_do_rw_disk(
  * 1073741822 == 549756 MB or 48bit addressing fake drive
  */
 
-static ide_startstop_t ide_do_rw_disk (ide_drive_t *drive, struct request *rq, 
sector_t block)
+static ide_startstop_t ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
+ sector_t block)
 {
ide_hwif_t *hwif = HWIF(drive);
 
@@ -452,7 +453,7 @@ static void idedisk_check_hpa(ide_drive_
  * in above order (i.e., if value of higher priority is available,
  * reset will be ignored).
  */
-static void init_idedisk_capacity (ide_drive_t  *drive)
+static void init_idedisk_capacity(ide_drive_t *drive)
 {
struct hd_driveid *id = drive-id;
/*
@@ -479,7 +480,7 @@ static void init_idedisk_capacity (ide_d
}
 }
 
-static sector_t idedisk_capacity (ide_drive_t *drive)
+static sector_t idedisk_capacity(ide_drive_t *drive)
 {
return drive-capacity64 - drive-sect0;
 }
@@ -524,10 +525,11 @@ static int proc_idedisk_read_cache
int len;
 
if (drive-id_read)
-   len = sprintf(out,%i\n, drive-id-buf_size / 2);
+   len = sprintf(out, %i\n, drive-id-buf_size / 2);
else
-   len = sprintf(out,(none)\n);
-   PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
+   len = sprintf(out, (none)\n);
+
+   PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
 }
 
 static int proc_idedisk_read_capacity
@@ -536,8 +538,9 @@ static int proc_idedisk_read_capacity
ide_drive_t*drive = (ide_drive_t *)data;
int len;
 
-   len = sprintf(page,%llu\n, (long long)idedisk_capacity(drive));
-   PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
+   len = sprintf(page, %llu\n, (long long)idedisk_capacity(drive));
+
+   PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
 }
 
 static int proc_idedisk_read_smart(char *page, char **start, off_t off,
@@ -551,12 +554,14 @@ static int proc_idedisk_read_smart(char 
char *out = ((char *)val) + (SECTOR_WORDS * 4);
page = out;
do {
-   out += sprintf(out, %04x%c, le16_to_cpu(*val), (++i  
7) ? ' ' : '\n');
+   out += sprintf(out, %04x%c, le16_to_cpu(*val),
+  (++i  7) ? ' ' : '\n');
val += 1;
} while (i  (SECTOR_WORDS * 2));
len = out - page;
}
-   PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
+
+   PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
 }
 
 static int proc_idedisk_read_sv
@@ -620,12 +625,13 @@ static int set_multcount(ide_drive_t *dr
if (drive-special.b.set_multmode)
return -EBUSY;
 
-   ide_init_drive_cmd (rq);
+   ide_init_drive_cmd(rq);
rq.cmd_type = REQ_TYPE_ATA_TASKFILE;
 
drive-mult_req = arg;
drive-special.b.set_multmode = 1;
-   (void) ide_do_drive_cmd (drive, rq, ide_wait);
+   (void)ide_do_drive_cmd(drive, rq, ide_wait);
+
return (drive-mult_count == arg) ? 0 : -EIO

[PATCH 2/4] ide-disk: add missing printk() KERN_* levels

2008-02-17 Thread Bartlomiej Zolnierkiewicz
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-disk.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Index: b/drivers/ide/ide-disk.c
===
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -867,7 +867,7 @@ static void idedisk_setup (ide_drive_t *
 
/* Only print cache size when it was specified */
if (id-buf_size)
-   printk ( w/%dKiB Cache, id-buf_size/2);
+   printk(KERN_CONT  w/%dKiB Cache, id-buf_size / 2);
 
printk(KERN_CONT , CHS=%d/%d/%d\n,
 drive-bios_cyl, drive-bios_head, drive-bios_sect);
@@ -949,7 +949,8 @@ static void ide_device_shutdown(ide_driv
return;
}
 
-   printk(Shutdown: %s\n, drive-name);
+   printk(KERN_INFO Shutdown: %s\n, drive-name);
+
drive-gendev.bus-suspend(drive-gendev, PMSG_SUSPEND);
 }
 
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] ide-disk: add proc_idedisk_read_smart() helper

2008-02-17 Thread Bartlomiej Zolnierkiewicz
* Factor out common code from proc_idedisk_read_smart_{thresholds,values}()
  to proc_idedisk_read_smart() helper.

* Rename proc_idedisk_read_smart_thresholds() to proc_idedisk_read_st()
  and proc_idedisk_read_smart_values() to proc_idedisk_read_sv().

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-disk.c |   39 +--
 1 file changed, 17 insertions(+), 22 deletions(-)

Index: b/drivers/ide/ide-disk.c
===
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -540,13 +540,13 @@ static int proc_idedisk_read_capacity
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
 }
 
-static int proc_idedisk_read_smart_thresholds
-   (char *page, char **start, off_t off, int count, int *eof, void *data)
+static int proc_idedisk_read_smart(char *page, char **start, off_t off,
+  int count, int *eof, void *data, u8 sub_cmd)
 {
ide_drive_t *drive = (ide_drive_t *)data;
int len = 0, i = 0;
 
-   if (get_smart_data(drive, page, SMART_READ_THRESHOLDS) == 0) {
+   if (get_smart_data(drive, page, sub_cmd) == 0) {
unsigned short *val = (unsigned short *) page;
char *out = ((char *)val) + (SECTOR_WORDS * 4);
page = out;
@@ -559,31 +559,26 @@ static int proc_idedisk_read_smart_thres
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
 }
 
-static int proc_idedisk_read_smart_values
+static int proc_idedisk_read_sv
(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
-   ide_drive_t *drive = (ide_drive_t *)data;
-   int len = 0, i = 0;
+   return proc_idedisk_read_smart(page, start, off, count, eof, data,
+  SMART_READ_VALUES);
+}
 
-   if (get_smart_data(drive, page, SMART_READ_VALUES) == 0) {
-   unsigned short *val = (unsigned short *) page;
-   char *out = ((char *)val) + (SECTOR_WORDS * 4);
-   page = out;
-   do {
-   out += sprintf(out, %04x%c, le16_to_cpu(*val), (++i  
7) ? ' ' : '\n');
-   val += 1;
-   } while (i  (SECTOR_WORDS * 2));
-   len = out - page;
-   }
-   PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
+static int proc_idedisk_read_st
+   (char *page, char **start, off_t off, int count, int *eof, void *data)
+{
+   return proc_idedisk_read_smart(page, start, off, count, eof, data,
+  SMART_READ_THRESHOLDS);
 }
 
 static ide_proc_entry_t idedisk_proc[] = {
-   { cache,  S_IFREG|S_IRUGO,
proc_idedisk_read_cache,NULL },
-   { capacity,   S_IFREG|S_IRUGO,
proc_idedisk_read_capacity, NULL },
-   { geometry,   S_IFREG|S_IRUGO,proc_ide_read_geometry, 
NULL },
-   { smart_values,   S_IFREG|S_IRUSR,
proc_idedisk_read_smart_values, NULL },
-   { smart_thresholds,   S_IFREG|S_IRUSR,
proc_idedisk_read_smart_thresholds, NULL },
+   { cache,S_IFREG|S_IRUGO, proc_idedisk_read_cache,NULL },
+   { capacity, S_IFREG|S_IRUGO, proc_idedisk_read_capacity, NULL },
+   { geometry, S_IFREG|S_IRUGO, proc_ide_read_geometry, NULL },
+   { smart_values, S_IFREG|S_IRUSR, proc_idedisk_read_sv,   NULL },
+   { smart_thresholds, S_IFREG|S_IRUSR, proc_idedisk_read_st,   NULL },
{ NULL, 0, NULL, NULL }
 };
 #endif /* CONFIG_IDE_PROC_FS */
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] ide: fix sparse warning about shadowing 'flags' symbol

2008-02-17 Thread Bartlomiej Zolnierkiewicz
drivers/ide/ide.c:801:18: warning: symbol 'flags' shadows an earlier one
drivers/ide/ide.c:732:16: originally declared here

Also fix some whitespace damage while at it.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide.c |   13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -797,10 +797,9 @@ int generic_ide_ioctl(ide_drive_t *drive
drive-nice1 = (arg  IDE_NICE_1)  1;
return 0;
case HDIO_DRIVE_RESET:
-   {
-   unsigned long flags;
-   if (!capable(CAP_SYS_ADMIN)) return -EACCES;
-   
+   if (!capable(CAP_SYS_ADMIN))
+   return -EACCES;
+
/*
 *  Abort the current command on the
 *  group if there is one, taking
@@ -819,17 +818,15 @@ int generic_ide_ioctl(ide_drive_t *drive
ide_abort(drive, drive reset);
 
BUG_ON(HWGROUP(drive)-handler);
-   
+
/* Ensure nothing gets queued after we
   drop the lock. Reset will clear the busy */
-  
+
HWGROUP(drive)-busy = 1;
spin_unlock_irqrestore(ide_lock, flags);
(void) ide_do_reset(drive);
 
return 0;
-   }
-
case HDIO_GET_BUSSTATE:
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] MAINTAINERS: update ide-cd maintainer's email address

2008-02-16 Thread Bartlomiej Zolnierkiewicz
On Saturday 16 February 2008, Borislav Petkov wrote:
 commit c65b97fdbb9f3075a37f711aa6b388a48a27d3f4
 Author: Borislav Petkov [EMAIL PROTECTED]
 Date:   Sat Feb 16 09:10:46 2008 +0100
 
 MAINTAINERS: update ide-cd maintainer's email address
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]

applied
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/12] ide: move default IDE ports setup to ide_generic host driver

2008-02-16 Thread Bartlomiej Zolnierkiewicz
* Make CONFIG_IDE_GENERIC depended on CONFIG_IDE_ARCH_OBSOLETE_DEFAULTS.

* Move default IDE ports setup from init_ide_data() to ide_generic
  host driver (remembering to not break idex=noprobe parameter).

* Use ide_init_port_hw() in ide_generic host driver.

* Remove no longer needed CONFIG_IDE_ARCH_OBSOLETE_DEFAULTS.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/Kconfig   |4 +---
 drivers/ide/ide-generic.c |   16 +---
 drivers/ide/ide.c |   18 --
 3 files changed, 14 insertions(+), 24 deletions(-)

Index: b/drivers/ide/Kconfig
===
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -307,6 +307,7 @@ comment IDE chipset support/bugfixes
 
 config IDE_GENERIC
tristate generic/default IDE chipset support
+   depends on ALPHA || X86 || IA64 || M32R || MIPS || PPC32
help
  If unsure, say N.
 
@@ -1096,9 +1097,6 @@ config BLK_DEV_IDEDMA
def_bool BLK_DEV_IDEDMA_SFF || BLK_DEV_IDEDMA_PMAC || \
 BLK_DEV_IDEDMA_ICS || BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
 
-config IDE_ARCH_OBSOLETE_DEFAULTS
-   def_bool ALPHA || X86 || IA64 || M32R || MIPS || PPC32
-
 endif
 
 config BLK_DEV_HD_ONLY
Index: b/drivers/ide/ide-generic.c
===
--- a/drivers/ide/ide-generic.c
+++ b/drivers/ide/ide-generic.c
@@ -94,11 +94,21 @@ static int __init ide_generic_init(void)
 
for (i = 0; i  MAX_HWIFS; i++) {
ide_hwif_t *hwif = ide_hwifs[i];
+   unsigned long io_addr = ide_default_io_base(i);
+   hw_regs_t hw;
+
+   if (hwif-chipset == ide_unknown  io_addr) {
+   u8 oldnoprobe = hwif-noprobe;
+
+   memset(hw, 0, sizeof(hw));
+   ide_std_init_ports(hw, io_addr, io_addr + 0x206);
+   hw.irq = ide_init_default_irq(io_addr);
+   ide_init_port_hw(hwif, hw);
+
+   hwif-noprobe = oldnoprobe;
 
-   if (hwif-io_ports[IDE_DATA_OFFSET] 
-   hwif-chipset == ide_unknown)
idx[i] = i;
-   else
+   } else
idx[i] = 0xff;
}
 
Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -167,12 +167,6 @@ static void ide_port_init_devices_data(i
}
 }
 
-#ifndef CONFIG_IDE_ARCH_OBSOLETE_DEFAULTS
-# define ide_default_io_base(index)(0)
-# define ide_default_irq(base) (0)
-# define ide_init_default_irq(base)(0)
-#endif
-
 /*
  * init_ide_data() sets reasonable default values into all fields
  * of all instances of the hwifs and drives, but only on the first call.
@@ -195,7 +189,6 @@ static void __init init_ide_data (void)
 {
unsigned int index;
static unsigned long magic_cookie = MAGIC_COOKIE;
-   hw_regs_t hw;
 
if (magic_cookie != MAGIC_COOKIE)
return; /* already initialized */
@@ -204,19 +197,8 @@ static void __init init_ide_data (void)
/* Initialise all interface structures */
for (index = 0; index  MAX_HWIFS; ++index) {
ide_hwif_t *hwif = ide_hwifs[index];
-   unsigned long io_addr = ide_default_io_base(index);
-   unsigned long ctl_addr = io_addr + 0x206;
 
ide_init_port_data(hwif, index);
-
-#ifdef CONFIG_IDE_ARCH_OBSOLETE_DEFAULTS
-   memset(hw, 0, sizeof(hw));
-   ide_std_init_ports(hw, io_addr, ctl_addr);
-   memcpy(hwif-io_ports, hw.io_ports, sizeof(hw.io_ports));
-   hwif-noprobe = !hwif-io_ports[IDE_DATA_OFFSET];
-   hwif-irq =
-   ide_init_default_irq(hwif-io_ports[IDE_DATA_OFFSET]);
-#endif
}
 }
 
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/12] ide: remove ide_init_default_irq() macro

2008-02-16 Thread Bartlomiej Zolnierkiewicz
* Use ide_default_irq() instead of ide_init_default_irq() in
  ide_generic host driver (so the correct IRQ is always set
  regardless of CONFIG_PCI / CONFIG_BLK_DEV_IDEPCI).

* Remove no longer needed ide_init_default_irq() macro.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide-generic.c   |2 +-
 include/asm-alpha/ide.h |6 --
 include/asm-ia64/ide.h  |6 --
 include/asm-m32r/ide.h  |6 --
 include/asm-mips/mach-generic/ide.h |6 --
 include/asm-powerpc/ide.h   |6 --
 include/asm-x86/ide.h   |6 --
 7 files changed, 1 insertion(+), 37 deletions(-)

Index: b/drivers/ide/ide-generic.c
===
--- a/drivers/ide/ide-generic.c
+++ b/drivers/ide/ide-generic.c
@@ -102,7 +102,7 @@ static int __init ide_generic_init(void)
 
memset(hw, 0, sizeof(hw));
ide_std_init_ports(hw, io_addr, io_addr + 0x206);
-   hw.irq = ide_init_default_irq(io_addr);
+   hw.irq = ide_default_irq(io_addr);
ide_init_port_hw(hwif, hw);
 
hwif-noprobe = oldnoprobe;
Index: b/include/asm-alpha/ide.h
===
--- a/include/asm-alpha/ide.h
+++ b/include/asm-alpha/ide.h
@@ -37,12 +37,6 @@ static inline unsigned long ide_default_
}
 }
 
-#ifdef CONFIG_PCI
-#define ide_init_default_irq(base) (0)
-#else
-#define ide_init_default_irq(base) ide_default_irq(base)
-#endif
-
 #include asm-generic/ide_iops.h
 
 #endif /* __KERNEL__ */
Index: b/include/asm-ia64/ide.h
===
--- a/include/asm-ia64/ide.h
+++ b/include/asm-ia64/ide.h
@@ -44,12 +44,6 @@ static inline unsigned long ide_default_
}
 }
 
-#ifdef CONFIG_PCI
-#define ide_init_default_irq(base) (0)
-#else
-#define ide_init_default_irq(base) ide_default_irq(base)
-#endif
-
 #include asm-generic/ide_iops.h
 
 #endif /* __KERNEL__ */
Index: b/include/asm-m32r/ide.h
===
--- a/include/asm-m32r/ide.h
+++ b/include/asm-m32r/ide.h
@@ -63,12 +63,6 @@ static __inline__ unsigned long ide_defa
}
 }
 
-#ifdef CONFIG_BLK_DEV_IDEPCI
-#define ide_init_default_irq(base) (0)
-#else
-#define ide_init_default_irq(base) ide_default_irq(base)
-#endif
-
 #include asm-generic/ide_iops.h
 
 #endif /* __KERNEL__ */
Index: b/include/asm-mips/mach-generic/ide.h
===
--- a/include/asm-mips/mach-generic/ide.h
+++ b/include/asm-mips/mach-generic/ide.h
@@ -96,12 +96,6 @@ static __inline__ unsigned long ide_defa
}
 }
 
-#ifdef CONFIG_BLK_DEV_IDEPCI
-#define ide_init_default_irq(base) (0)
-#else
-#define ide_init_default_irq(base) ide_default_irq(base)
-#endif
-
 /* MIPS port and memory-mapped I/O string operations.  */
 static inline void __ide_flush_prologue(void)
 {
Index: b/include/asm-powerpc/ide.h
===
--- a/include/asm-powerpc/ide.h
+++ b/include/asm-powerpc/ide.h
@@ -73,12 +73,6 @@ static __inline__ unsigned long ide_defa
return 0;
 }
 
-#ifdef CONFIG_PCI
-#define ide_init_default_irq(base) (0)
-#else
-#define ide_init_default_irq(base) ide_default_irq(base)
-#endif
-
 #ifdef CONFIG_BLK_DEV_MPC8xx_IDE
 #define IDE_ARCH_ACK_INTR  1
 #define ide_ack_intr(hwif) ((hwif)-ack_intr ? (hwif)-ack_intr(hwif) : 1)
Index: b/include/asm-x86/ide.h
===
--- a/include/asm-x86/ide.h
+++ b/include/asm-x86/ide.h
@@ -58,12 +58,6 @@ static __inline__ unsigned long ide_defa
}
 }
 
-#ifdef CONFIG_BLK_DEV_IDEPCI
-#define ide_init_default_irq(base) (0)
-#else
-#define ide_init_default_irq(base) ide_default_irq(base)
-#endif
-
 #include asm-generic/ide_iops.h
 
 #endif /* __KERNEL__ */
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/12] ide: cleanup ide_match_hwif()

2008-02-16 Thread Bartlomiej Zolnierkiewicz
* Remove no longer needed matching against I/O base and 'io_base' argument.

* Move printk() to the caller and remove 'name' argument.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/setup-pci.c |   47 +++
 1 file changed, 15 insertions(+), 32 deletions(-)

Index: b/drivers/ide/setup-pci.c
===
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -22,42 +22,20 @@
 
 
 /**
- * ide_match_hwif  -   match a PCI IDE against an ide_hwif
- * @io_base: I/O base of device
- * @bootable: set if its bootable
- * @name: name of device
+ * ide_match_hwif  -   find free ide_hwifs[] slot
+ * @bootable: bootable flag
  *
- * Match a PCI IDE port against an entry in ide_hwifs[],
- * based on io_base port if possible. Return the matching hwif,
- * or a new hwif. If we find an error (clashing, out of devices, etc)
- * return NULL
- *
- * FIXME: we need to handle mmio matches here too
+ * Return the new hwif.  If we are out of free slots return NULL.
  */
 
-static ide_hwif_t *ide_match_hwif(unsigned long io_base, u8 bootable, const 
char *name)
+static ide_hwif_t *ide_match_hwif(u8 bootable)
 {
-   int h;
ide_hwif_t *hwif;
+   int h;
 
/*
-* Look for a hwif with matching io_base default value.
-* If chipset is ide_unknown, then claim that hwif slot.
-* Otherwise, some other chipset has already claimed it..  :(
-*/
-   for (h = 0; h  MAX_HWIFS; ++h) {
-   hwif = ide_hwifs[h];
-   if (hwif-io_ports[IDE_DATA_OFFSET] == io_base) {
-   if (hwif-chipset == ide_unknown)
-   return hwif; /* match */
-   printk(KERN_ERR %s: port 0x%04lx already claimed by 
%s\n,
-   name, io_base, hwif-name);
-   return NULL;/* already claimed */
-   }
-   }
-   /*
-* Okay, there is no hwif matching our io_base,
-* so we'll just claim an unassigned slot.
+* Claim an unassigned slot.
+*
 * Give preference to claiming other slots before claiming ide0/ide1,
 * just in case there's another interface yet-to-be-scanned
 * which uses ports 1f0/170 (the ide0/ide1 defaults).
@@ -83,7 +61,7 @@ static ide_hwif_t *ide_match_hwif(unsign
if (hwif-chipset == ide_unknown)
return hwif;/* pick an unused entry */
}
-   printk(KERN_ERR %s: too many IDE interfaces, no room in table\n, 
name);
+
return NULL;
 }
 
@@ -367,8 +345,13 @@ static ide_hwif_t *ide_hwif_configure(st
ctl = port ? 0x374 : 0x3f4;
base = port ? 0x170 : 0x1f0;
}
-   if ((hwif = ide_match_hwif(base, bootable, d-name)) == NULL)
-   return NULL;/* no room in ide_hwifs[] */
+
+   hwif = ide_match_hwif(bootable);
+   if (hwif == NULL) {
+   printk(KERN_ERR %s: too many IDE interfaces, no room in 
+   table\n, d-name);
+   return NULL;
+   }
 
memset(hw, 0, sizeof(hw));
hw.irq = irq;
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/12] ide: cleanup ide_find_port()

2008-02-16 Thread Bartlomiej Zolnierkiewicz
Remove no longer needed matching against I/O base and 'base' argument.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/arm/bast-ide.c|2 +-
 drivers/ide/arm/icside.c  |2 +-
 drivers/ide/arm/ide_arm.c |2 +-
 drivers/ide/arm/palm_bk3710.c |2 +-
 drivers/ide/arm/rapide.c  |2 +-
 drivers/ide/cris/ide-cris.c   |2 +-
 drivers/ide/h8300/ide-h8300.c |3 +--
 drivers/ide/ide-generic.c |2 +-
 drivers/ide/ide-pnp.c |2 +-
 drivers/ide/ide.c |   15 +++
 drivers/ide/legacy/buddha.c   |2 +-
 drivers/ide/legacy/falconide.c|2 +-
 drivers/ide/legacy/gayle.c|2 +-
 drivers/ide/legacy/ide-cs.c   |2 +-
 drivers/ide/legacy/ide_platform.c |2 +-
 drivers/ide/legacy/macide.c   |2 +-
 drivers/ide/legacy/q40ide.c   |2 +-
 drivers/ide/pci/delkin_cb.c   |2 +-
 include/linux/ide.h   |2 +-
 19 files changed, 21 insertions(+), 31 deletions(-)

Index: b/drivers/ide/arm/bast-ide.c
===
--- a/drivers/ide/arm/bast-ide.c
+++ b/drivers/ide/arm/bast-ide.c
@@ -41,7 +41,7 @@ static int __init bastide_register(unsig
hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20);
hw.irq = irq;
 
-   hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
+   hwif = ide_find_port();
if (hwif == NULL)
goto out;
 
Index: b/drivers/ide/arm/icside.c
===
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -400,7 +400,7 @@ icside_setup(void __iomem *base, struct 
unsigned long port = (unsigned long)base + info-dataoffset;
ide_hwif_t *hwif;
 
-   hwif = ide_find_port(port);
+   hwif = ide_find_port();
if (hwif) {
int i;
 
Index: b/drivers/ide/arm/ide_arm.c
===
--- a/drivers/ide/arm/ide_arm.c
+++ b/drivers/ide/arm/ide_arm.c
@@ -34,7 +34,7 @@ static int __init ide_arm_init(void)
ide_std_init_ports(hw, IDE_ARM_IO, IDE_ARM_IO + 0x206);
hw.irq = IDE_ARM_IRQ;
 
-   hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
+   hwif = ide_find_port();
if (hwif) {
ide_init_port_hw(hwif, hw);
idx[0] = hwif-index;
Index: b/drivers/ide/arm/palm_bk3710.c
===
--- a/drivers/ide/arm/palm_bk3710.c
+++ b/drivers/ide/arm/palm_bk3710.c
@@ -378,7 +378,7 @@ static int __devinit palm_bk3710_probe(s
hw.irq = irq-start;
hw.chipset = ide_palm3710;
 
-   hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
+   hwif = ide_find_port();
if (hwif == NULL)
goto out;
 
Index: b/drivers/ide/arm/rapide.c
===
--- a/drivers/ide/arm/rapide.c
+++ b/drivers/ide/arm/rapide.c
@@ -44,7 +44,7 @@ rapide_probe(struct expansion_card *ec, 
goto release;
}
 
-   hwif = ide_find_port((unsigned long)base);
+   hwif = ide_find_port();
if (hwif) {
memset(hw, 0, sizeof(hw));
rapide_setup_ports(hw, base, base + 0x818, 1  6, ec-irq);
Index: b/drivers/ide/cris/ide-cris.c
===
--- a/drivers/ide/cris/ide-cris.c
+++ b/drivers/ide/cris/ide-cris.c
@@ -804,7 +804,7 @@ static int __init init_e100_ide(void)
 
cris_setup_ports(hw, cris_ide_base_address(h));
 
-   hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
+   hwif = ide_find_port();
if (hwif == NULL)
continue;
ide_init_port_data(hwif, hwif-index);
Index: b/drivers/ide/h8300/ide-h8300.c
===
--- a/drivers/ide/h8300/ide-h8300.c
+++ b/drivers/ide/h8300/ide-h8300.c
@@ -99,8 +99,7 @@ static int __init h8300_ide_init(void)
 
hw_setup(hw);
 
-   /* register if */
-   hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
+   hwif = ide_find_port();
if (hwif == NULL) {
printk(KERN_ERR ide-h8300: IDE I/F register failed\n);
return -ENOENT;
Index: b/drivers/ide/ide-generic.c
===
--- a/drivers/ide/ide-generic.c
+++ b/drivers/ide/ide-generic.c
@@ -33,7 +33,7 @@ static ssize_t store_add(struct class *c
if (sscanf(buf, %x:%x:%d, base, ctl, irq) != 3)
return -EINVAL;
 
-   hwif = ide_find_port(base);
+   hwif = ide_find_port();
if (hwif == NULL)
return -ENOENT;
 
Index: b/drivers/ide/ide-pnp.c
===
--- a/drivers/ide

[PATCH 06/12] ide: limit legacy VLB host drivers to alpha, x86 and mips

2008-02-16 Thread Bartlomiej Zolnierkiewicz
These host drivers indirectly depend on CONFIG_IDE_ARCH_OBSOLETE_DEFAULTS=y
which is defined only on alpha, x86, ia64, m32r, mips and ppc32.

Moreover:

- on ia64 there is no ISA

- m32r is too new for VLB

- on ppc32 ISA is available only on PPC_CHRP (no default IDE ports)
  and PPC_PREP (marked as BROKEN)

[ the common sense tells me that VLB was only used on x86 but there
  are urban legends that one of these host drivers was needed on some
  other arch - thus the extra care ]

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/Kconfig |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/drivers/ide/Kconfig
===
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -1031,7 +1031,7 @@ config IDE_EXT_DIRECT
 endchoice
 
 # no isa - no vlb
-if ISA
+if ISA  (ALPHA || X86 || MIPS)
 
 comment Other IDE chipsets support
 comment Note: most of these also require special kernel boot parameters
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/12] ide: add ide-4drives host driver

2008-02-16 Thread Bartlomiej Zolnierkiewicz
CONFIG_BLK_DEV_4DRIVES deserves its own host driver:

* Add drivers/ide/legacy/ide-4drives.c and move 4drives support there.

* Add ide-4drives.o in the link order after all other legacy host
  drivers enabled by ide0= options (they all are mutually exclusive).

* Make ide-4drives host driver probe itself for IDE devices instead of
  indirectly depending on ide_generic host driver.

* Add probe module parameter to ide-4drives and update documentation.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 Documentation/ide.txt|5 ++--
 drivers/ide/Kconfig  |4 +--
 drivers/ide/ide.c|   15 ++--
 drivers/ide/legacy/Makefile  |1 
 drivers/ide/legacy/ide-4drives.c |   46 +++
 5 files changed, 55 insertions(+), 16 deletions(-)

Index: b/Documentation/ide.txt
===
--- a/Documentation/ide.txt
+++ b/Documentation/ide.txt
@@ -242,8 +242,6 @@ Summary of ide driver parameters for ker
  both the respective primary and secondary channel
  to take effect.
 
- idex=four   : four drives on idex and ide(x^1) share same ports
-   
  idex=reset  : reset interface after probe
 
  idex=ata66  : informs the interface that it has an 80c cable
@@ -276,6 +274,9 @@ Also for legacy CMD640 host driver (cmd6
 kernel paremeter to enable probing for VLB version of the chipset (PCI ones
 are detected automatically).
 
+You also need to use probe kernel paramater for ide-4drives driver
+(support for IDE generic chipset with four drives on one port).
+
 

 
 IDE ATAPI streaming tape driver
Index: b/drivers/ide/Kconfig
===
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -1042,8 +1042,8 @@ config BLK_DEV_4DRIVES
  Certain older chipsets, including the Tekram 690CD, use a single set
  of I/O ports at 0x1f0 to control up to four drives, instead of the
  customary two drives per port. Support for this can be enabled at
- runtime using the ide0=four kernel boot parameter if you say Y
- here.
+ runtime using the ide_4drives.probe kernel boot parameter if you
+ say Y here.
 
 config BLK_DEV_ALI14XX
tristate ALI M14xx support
Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -989,6 +989,7 @@ extern int probe_dtc2278;
 extern int probe_ht6560b;
 extern int probe_qd65xx;
 extern int cmd640_vlb;
+extern int probe_4drives;
 
 static int __initdata is_chipset_set[MAX_HWIFS];
 
@@ -1213,19 +1214,9 @@ static int __init ide_setup(char *s)
 #endif
 #ifdef CONFIG_BLK_DEV_4DRIVES
case -11: /* four drives on one set of ports */
-   {
-   ide_hwif_t *mate = ide_hwifs[hw^1];
-   mate-drives[0].select.all ^= 0x20;
-   mate-drives[1].select.all ^= 0x20;
-   hwif-chipset = mate-chipset = ide_4drives;
-   mate-irq = hwif-irq;
-   memcpy(mate-io_ports, hwif-io_ports, 
sizeof(hwif-io_ports));
-   hwif-mate = mate;
-   mate-mate = hwif;
-   hwif-serialized = mate-serialized = 1;
+   probe_4drives = 1;
goto obsolete_option;
-   }
-#endif /* CONFIG_BLK_DEV_4DRIVES */
+#endif
case -10: /* minus10 */
case -9: /* minus9 */
case -8: /* minus8 */
Index: b/drivers/ide/legacy/Makefile
===
--- a/drivers/ide/legacy/Makefile
+++ b/drivers/ide/legacy/Makefile
@@ -6,6 +6,7 @@ obj-$(CONFIG_BLK_DEV_UMC8672)   += umc867
 obj-$(CONFIG_BLK_DEV_DTC2278)  += dtc2278.o
 obj-$(CONFIG_BLK_DEV_HT6560B)  += ht6560b.o
 obj-$(CONFIG_BLK_DEV_QD65XX)   += qd65xx.o
+obj-$(CONFIG_BLK_DEV_4DRIVES)  += ide-4drives.o
 
 obj-$(CONFIG_BLK_DEV_GAYLE)+= gayle.o
 obj-$(CONFIG_BLK_DEV_FALCON_IDE)   += falconide.o
Index: b/drivers/ide/legacy/ide-4drives.c
===
--- /dev/null
+++ b/drivers/ide/legacy/ide-4drives.c
@@ -0,0 +1,46 @@
+
+#include linux/kernel.h
+#include linux/init.h
+#include linux/module.h
+#include linux/ide.h
+
+int probe_4drives = 0;
+
+module_param_named(probe, probe_4drives, bool, 0);
+MODULE_PARM_DESC(probe, probe for generic IDE chipset with 4 drives/port);
+
+static int __init ide_4drives_init(void

[PATCH 04/12] cmd640: cleanup setup_device_ptrs()

2008-02-16 Thread Bartlomiej Zolnierkiewicz
This loop is no longer needed.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/pci/cmd640.c |   14 ++
 1 file changed, 2 insertions(+), 12 deletions(-)

Index: b/drivers/ide/pci/cmd640.c
===
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -409,19 +409,9 @@ static void __init check_prefetch (unsig
  */
 static void __init setup_device_ptrs (void)
 {
-   unsigned int i;
+   cmd_hwif0 = ide_hwifs[0];
+   cmd_hwif1 = ide_hwifs[1];
 
-   cmd_hwif0 = ide_hwifs[0]; /* default, if not found below */
-   cmd_hwif1 = ide_hwifs[1]; /* default, if not found below */
-   for (i = 0; i  MAX_HWIFS; i++) {
-   ide_hwif_t *hwif = ide_hwifs[i];
-   if (hwif-chipset == ide_unknown) {
-   if (hwif-io_ports[IDE_DATA_OFFSET] == 0x1f0)
-   cmd_hwif0 = hwif;
-   else if (hwif-io_ports[IDE_DATA_OFFSET] == 0x170)
-   cmd_hwif1 = hwif;
-   }
-   }
cmd_drives[0] = cmd_hwif0-drives[0];
cmd_drives[1] = cmd_hwif0-drives[1];
cmd_drives[2] = cmd_hwif1-drives[0];
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/12] ide: init hwif-{io_ports,irq} explicitly in legacy VLB host drivers

2008-02-16 Thread Bartlomiej Zolnierkiewicz
Do explicit port setup in legacy VLB host drivers instead of depending
on init_ide_data().  This way hwif-io_ports[] and hwif-irq are always
correctly set regardless of CONFIG_PCI / CONFIG_BLK_DEV_IDEPCI.

[ No need to care about idex=noprobe parameter for these drivers
  as they need to be explicitly enabled with probe parameter. ]

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/legacy/ali14xx.c |   12 
 drivers/ide/legacy/dtc2278.c |   12 
 drivers/ide/legacy/ht6560b.c |   12 
 drivers/ide/legacy/ide-4drives.c |   10 +++---
 drivers/ide/legacy/qd65xx.c  |   19 +--
 drivers/ide/legacy/umc8672.c |   12 
 6 files changed, 72 insertions(+), 5 deletions(-)

Index: b/drivers/ide/legacy/ali14xx.c
===
--- a/drivers/ide/legacy/ali14xx.c
+++ b/drivers/ide/legacy/ali14xx.c
@@ -200,6 +200,7 @@ static const struct ide_port_info ali14x
 static int __init ali14xx_probe(void)
 {
static u8 idx[4] = { 0, 1, 0xff, 0xff };
+   hw_regs_t hw[2];
 
printk(KERN_DEBUG ali14xx: base=0x%03x, regOn=0x%02x.\n,
  basePort, regOn);
@@ -210,6 +211,17 @@ static int __init ali14xx_probe(void)
return 1;
}
 
+   memset(hw, 0, sizeof(hw));
+
+   ide_std_init_ports(hw[0], 0x1f0, 0x3f6);
+   hw[0].irq = 14;
+
+   ide_std_init_ports(hw[1], 0x170, 0x376);
+   hw[1].irq = 15;
+
+   ide_init_port_hw(ide_hwifs[0], hw[0]);
+   ide_init_port_hw(ide_hwifs[1], hw[1]);
+
ide_hwifs[0].set_pio_mode = ali14xx_set_pio_mode;
ide_hwifs[1].set_pio_mode = ali14xx_set_pio_mode;
 
Index: b/drivers/ide/legacy/dtc2278.c
===
--- a/drivers/ide/legacy/dtc2278.c
+++ b/drivers/ide/legacy/dtc2278.c
@@ -103,6 +103,7 @@ static int __init dtc2278_probe(void)
unsigned long flags;
ide_hwif_t *hwif, *mate;
static u8 idx[4] = { 0, 1, 0xff, 0xff };
+   hw_regs_t hw[2];
 
hwif = ide_hwifs[0];
mate = ide_hwifs[1];
@@ -128,6 +129,17 @@ static int __init dtc2278_probe(void)
 #endif
local_irq_restore(flags);
 
+   memset(hw, 0, sizeof(hw));
+
+   ide_std_init_ports(hw[0], 0x1f0, 0x3f6);
+   hw[0].irq = 14;
+
+   ide_std_init_ports(hw[1], 0x170, 0x376);
+   hw[1].irq = 15;
+
+   ide_init_port_hw(hwif, hw[0]);
+   ide_init_port_hw(mate, hw[1]);
+
hwif-set_pio_mode = dtc2278_set_pio_mode;
 
ide_device_add(idx, dtc2278_port_info);
Index: b/drivers/ide/legacy/ht6560b.c
===
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -331,6 +331,7 @@ static int __init ht6560b_init(void)
 {
ide_hwif_t *hwif, *mate;
static u8 idx[4] = { 0, 1, 0xff, 0xff };
+   hw_regs_t hw[2];
 
if (probe_ht6560b == 0)
return -ENODEV;
@@ -349,6 +350,17 @@ static int __init ht6560b_init(void)
goto release_region;
}
 
+   memset(hw, 0, sizeof(hw));
+
+   ide_std_init_ports(hw[0], 0x1f0, 0x3f6);
+   hw[0].irq = 14;
+
+   ide_std_init_ports(hw[1], 0x170, 0x376);
+   hw[1].irq = 15;
+
+   ide_init_port_hw(hwif, hw[0]);
+   ide_init_port_hw(mate, hw[1]);
+
hwif-selectproc = ht6560b_selectproc;
hwif-set_pio_mode = ht6560b_set_pio_mode;
 
Index: b/drivers/ide/legacy/ide-4drives.c
===
--- a/drivers/ide/legacy/ide-4drives.c
+++ b/drivers/ide/legacy/ide-4drives.c
@@ -13,6 +13,7 @@ static int __init ide_4drives_init(void)
 {
ide_hwif_t *hwif, *mate;
u8 idx[4] = { 0, 1, 0xff, 0xff };
+   hw_regs_t hw;
 
if (probe_4drives == 0)
return -ENODEV;
@@ -20,11 +21,14 @@ static int __init ide_4drives_init(void)
hwif = ide_hwifs[0];
mate = ide_hwifs[1];
 
-   memcpy(mate-io_ports, hwif-io_ports, sizeof(hwif-io_ports));
+   memset(hw, 0, sizeof(hw));
 
-   mate-irq = hwif-irq;
+   ide_std_init_ports(hw, 0x1f0, 0x3f6);
+   hw.irq = 14;
+   hw.chipset = ide_4drives;
 
-   mate-chipset = hwif-chipset = ide_4drives;
+   ide_init_port_hw(hwif, hw);
+   ide_init_port_hw(mate, hw);
 
mate-drives[0].select.all ^= 0x20;
mate-drives[1].select.all ^= 0x20;
Index: b/drivers/ide/legacy/qd65xx.c
===
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -389,9 +389,9 @@ static const struct ide_port_info qd65xx
 static int __init qd_probe(int base)
 {
ide_hwif_t *hwif;
+   u8 config, unit;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
-   u8 config;
-   u8 unit;
+   hw_regs_t hw[2];
 
config = inb(QD_CONFIG_PORT);
 
@@ -400,6

Re: [BUID_FAILURE] next-20080215 Build failure caused by ide: rework PowerMac media-bay support

2008-02-16 Thread Bartlomiej Zolnierkiewicz
On Friday 15 February 2008, Kamalesh Babulal wrote:
 The linux-next-20080215 kernel build fails on the powerpc with
 following error
  
   CC  arch/powerpc/platforms/powermac/setup.o
 In file included from arch/powerpc/platforms/powermac/setup.c:66:
 include/asm/mediabay.h:29: error: syntax error before 'ide_hwif_t'
 include/asm/mediabay.h:29: warning: function declaration isn't a prototype
 make[2]: *** [arch/powerpc/platforms/powermac/setup.o] Error 1
 make[1]: *** [arch/powerpc/platforms/powermac] Error 2
 make: *** [arch/powerpc/platforms] Error 2
 
 This build failure is caused by the  ide: rework PowerMac media-bay support
 patch.This problem was reported and solution suggested according to
 http://lkml.org/lkml/2008/2/13/195 including the 
 
 #include linux/ide.h after
 
 #ifdef CONFIG_BLK_DEV_IDE_PMAC
 
 helps in fixing the build failure.

Thanks, I fixed the original patch.

interdiff:

[...]
v2:
* Fix build by adding linux/ide.h include to asm-powerpc/mediabay.h.
  (Reported by Michael/Kamalesh/Andrew).

Cc: Kamalesh Babulal [EMAIL PROTECTED]
Cc: Michael Ellerman [EMAIL PROTECTED]
Cc: Andrew Morton [EMAIL PROTECTED]
[...]

diff -u b/include/asm-powerpc/mediabay.h b/include/asm-powerpc/mediabay.h
--- b/include/asm-powerpc/mediabay.h
+++ b/include/asm-powerpc/mediabay.h
@@ -23,6 +23,8 @@
 extern int media_bay_count;
 
 #ifdef CONFIG_BLK_DEV_IDE_PMAC
+#include linux/ide.h
+
 int check_media_bay_by_base(unsigned long base, int what);
 /* called by IDE PMAC host driver to register IDE controller for media bay */
 int media_bay_set_ide_infos(struct device_node *which_bay, unsigned long base,


-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/12] ide: remove ide_default_io_ctl() macro

2008-02-16 Thread Bartlomiej Zolnierkiewicz
It is always == '((base) + 0x206)' if CONFIG_IDE_ARCH_OBSOLETE_DEFAULTS=y
and it is not needed otherwise (arm, blackfin, parisc, ppc64, sh, sparc[64]).

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide.c   |2 +-
 include/asm-alpha/ide.h |2 --
 include/asm-arm/ide.h   |8 
 include/asm-blackfin/ide.h  |4 
 include/asm-ia64/ide.h  |2 --
 include/asm-m32r/ide.h  |2 --
 include/asm-mips/mach-generic/ide.h |2 --
 include/asm-parisc/ide.h|2 --
 include/asm-powerpc/ide.h   |2 --
 include/asm-sh/ide.h|3 ---
 include/asm-sparc/ide.h |2 --
 include/asm-sparc64/ide.h   |2 --
 include/asm-x86/ide.h   |2 --
 13 files changed, 1 insertion(+), 34 deletions(-)

Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -205,7 +205,7 @@ static void __init init_ide_data (void)
for (index = 0; index  MAX_HWIFS; ++index) {
ide_hwif_t *hwif = ide_hwifs[index];
unsigned long io_addr = ide_default_io_base(index);
-   unsigned long ctl_addr = ide_default_io_ctl(io_addr);
+   unsigned long ctl_addr = io_addr + 0x206;
 
ide_init_port_data(hwif, index);
 
Index: b/include/asm-alpha/ide.h
===
--- a/include/asm-alpha/ide.h
+++ b/include/asm-alpha/ide.h
@@ -37,8 +37,6 @@ static inline unsigned long ide_default_
}
 }
 
-#define ide_default_io_ctl(base)   ((base) + 0x206) /* obsolete */
-
 #ifdef CONFIG_PCI
 #define ide_init_default_irq(base) (0)
 #else
Index: b/include/asm-arm/ide.h
===
--- a/include/asm-arm/ide.h
+++ b/include/asm-arm/ide.h
@@ -17,14 +17,6 @@
 #define MAX_HWIFS  4
 #endif
 
-#if !defined(CONFIG_ARCH_L7200)
-# ifdef CONFIG_ARCH_CLPS7500
-#  define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
-# else
-#  define ide_default_io_ctl(base) (0)
-# endif
-#endif /* !ARCH_L7200 */
-
 #define __ide_mm_insw(port,addr,len)   readsw(port,addr,len)
 #define __ide_mm_insl(port,addr,len)   readsl(port,addr,len)
 #define __ide_mm_outsw(port,addr,len)  writesw(port,addr,len)
Index: b/include/asm-blackfin/ide.h
===
--- a/include/asm-blackfin/ide.h
+++ b/include/asm-blackfin/ide.h
@@ -19,10 +19,6 @@
 
 #define MAX_HWIFS  1
 
-/* Legacy ... BLK_DEV_IDECS */
-#define ide_default_io_ctl(base)   ((base) + 0x206) /* obsolete */
-
-
 #include asm-generic/ide_iops.h
 
 //
Index: b/include/asm-ia64/ide.h
===
--- a/include/asm-ia64/ide.h
+++ b/include/asm-ia64/ide.h
@@ -44,8 +44,6 @@ static inline unsigned long ide_default_
}
 }
 
-#define ide_default_io_ctl(base)   ((base) + 0x206) /* obsolete */
-
 #ifdef CONFIG_PCI
 #define ide_init_default_irq(base) (0)
 #else
Index: b/include/asm-m32r/ide.h
===
--- a/include/asm-m32r/ide.h
+++ b/include/asm-m32r/ide.h
@@ -63,8 +63,6 @@ static __inline__ unsigned long ide_defa
}
 }
 
-#define ide_default_io_ctl(base)   ((base) + 0x206) /* obsolete */
-
 #ifdef CONFIG_BLK_DEV_IDEPCI
 #define ide_init_default_irq(base) (0)
 #else
Index: b/include/asm-mips/mach-generic/ide.h
===
--- a/include/asm-mips/mach-generic/ide.h
+++ b/include/asm-mips/mach-generic/ide.h
@@ -96,8 +96,6 @@ static __inline__ unsigned long ide_defa
}
 }
 
-#define ide_default_io_ctl(base)   ((base) + 0x206) /* obsolete */
-
 #ifdef CONFIG_BLK_DEV_IDEPCI
 #define ide_init_default_irq(base) (0)
 #else
Index: b/include/asm-parisc/ide.h
===
--- a/include/asm-parisc/ide.h
+++ b/include/asm-parisc/ide.h
@@ -17,8 +17,6 @@
 #define MAX_HWIFS  2
 #endif
 
-#define ide_default_io_ctl(base)   ((base) + 0x206) /* obsolete */
-
 #define ide_request_irq(irq,hand,flg,dev,id)   
request_irq((irq),(hand),(flg),(dev),(id))
 #define ide_free_irq(irq,dev_id)   free_irq((irq), (dev_id))
 #define ide_request_region(from,extent,name)   request_region((from), 
(extent), (name))
Index: b/include/asm-powerpc/ide.h
===
--- a/include/asm-powerpc/ide.h
+++ b/include/asm-powerpc/ide.h
@@ -86,8 +86,6 @@ static __inline__ unsigned long ide_defa
 
 #endif /* __powerpc64__ */
 
-#define ide_default_io_ctl(base)   ((base) + 0x206) /* obsolete */
-
 #endif /* __KERNEL__ */
 
 #endif

[PATCH 05/12] cmd640: init hwif-{io_ports,irq} explicitly

2008-02-16 Thread Bartlomiej Zolnierkiewicz
Do explicit port setup instead of depending on init_ide_data().

This way hwif-io_ports[] and hwif-irq are always correctly set
regardless of CONFIG_PCI / CONFIG_BLK_DEV_IDEPCI.

[ Remember to not break idex=noprobe parameter. ]

While at it fix printk().

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/pci/cmd640.c |   23 ---
 1 file changed, 20 insertions(+), 3 deletions(-)

Index: b/drivers/ide/pci/cmd640.c
===
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -712,8 +712,9 @@ static int __init cmd640x_init(void)
int second_port_cmd640 = 0;
const char *bus_type, *port2;
unsigned int index;
-   u8 b, cfr;
+   u8 b, cfr, oldnoprobe;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
+   hw_regs_t hw[2];
 
if (cmd640_vlb  probe_for_cmd640_vlb()) {
bus_type = VLB;
@@ -752,12 +753,25 @@ static int __init cmd640x_init(void)
return 0;
}
 
+   memset(hw, 0, sizeof(hw));
+
+   ide_std_init_ports(hw[0], 0x1f0, 0x3f6);
+   hw[0].irq = 14;
+
+   ide_std_init_ports(hw[1], 0x170, 0x376);
+   hw[1].irq = 15;
+
+   printk(KERN_INFO cmd640: buggy cmd640%c interface on %s, config=0x%02x
+\n, 'a' + cmd640_chip_version - 1, bus_type, cfr);
+
/*
 * Initialize data for primary port
 */
setup_device_ptrs ();
-   printk(%s: buggy cmd640%c interface on %s, config=0x%02x\n,
-  cmd_hwif0-name, 'a' + cmd640_chip_version - 1, bus_type, cfr);
+
+   oldnoprobe = cmd_hwif0-noprobe;
+   ide_init_port_hw(cmd_hwif0, hw[0]);
+   cmd_hwif0-noprobe = oldnoprobe;
 #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
cmd_hwif0-set_pio_mode = cmd640_set_pio_mode;
 #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
@@ -809,6 +823,9 @@ static int __init cmd640x_init(void)
 * Initialize data for secondary cmd640 port, if enabled
 */
if (second_port_cmd640) {
+   oldnoprobe = cmd_hwif1-noprobe;
+   ide_init_port_hw(cmd_hwif1, hw[1]);
+   cmd_hwif1-noprobe = oldnoprobe;
 #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
cmd_hwif1-set_pio_mode = cmd640_set_pio_mode;
 #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/12] ide: remove ppc ifdef from init_ide_data()

2008-02-16 Thread Bartlomiej Zolnierkiewicz
On PPC32 ide_init_default_irq() is non-zero only for PPLUS and PPC_PREP
(the latter marked as BROKEN currently) so this ifdef can be removed.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ide.c |2 --
 1 file changed, 2 deletions(-)

Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -214,11 +214,9 @@ static void __init init_ide_data (void)
ide_std_init_ports(hw, io_addr, ctl_addr);
memcpy(hwif-io_ports, hw.io_ports, sizeof(hw.io_ports));
hwif-noprobe = !hwif-io_ports[IDE_DATA_OFFSET];
-#if !defined(CONFIG_PPC32) || defined(CONFIG_PPLUS) || !defined(CONFIG_PCI)
hwif-irq =
ide_init_default_irq(hwif-io_ports[IDE_DATA_OFFSET]);
 #endif
-#endif
}
 }
 
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: IDE cdrom problem

2008-02-16 Thread Bartlomiej Zolnierkiewicz
On Saturday 16 February 2008, Borislav Petkov wrote:
 On Sat, Feb 16, 2008 at 04:24:46PM +0100, Bartlomiej Zolnierkiewicz wrote:
  
  [ added Borislav (ide-cd maintainer) to cc: ]
  
  Hi,
  
  Unless there are some very important reasons to keep the discussion private
  please always cc: linux-ide@ and/or linux-kernel@ ML when reporting 
  problems.
  
  Othewise your mail misses many knowledgeable people and is left on mercy
  of clueless IDE maintainer... ;-)
  
  --  Forwarded Message  --
  
  Subject: IDE cdrom problem
  Date: Saturday 16 February 2008
  From: WaVeR [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  
  Hello Bart,
  
  Sorry to distrub you, but I have a similar problem like this post
  http://lkml.org/lkml/2008/2/12/97
  
  I'm not subscribed to linux ML, so I decide to write you directly.
  
  
  From my dmesg, I get this error:
  
  Feb 16 08:01:58 Jupiter kernel: hdc: cdrom_pc_intr: The drive appears
  confused (ireason = 0x01). Trying to recover by ending request.
  Feb 16 08:06:16 Jupiter kernel: hdc: cdrom_pc_intr: The drive appears
  confused (ireason = 0x01). Trying to recover by ending request.
  Feb 16 08:10:45 Jupiter kernel: hdd: cdrom_pc_intr: The drive appears
  confused (ireason = 0x01). Trying to recover by ending request.
  Feb 16 08:37:41 Jupiter kernel: hdd: cdrom_pc_intr: The drive appears
  confused (ireason = 0x01). Trying to recover by ending request.
  Feb 16 08:42:10 Jupiter kernel: hdc: cdrom_pc_intr: The drive appears
  confused (ireason = 0x01). Trying to recover by ending request.
  Feb 16 09:00:07 Jupiter kernel: hdd: cdrom_pc_intr: The drive appears
  confused (ireason = 0x01). Trying to recover by ending request.
 
 Yeah, this is kinda funny, i think i've seen that somewhere :) But seriously,

Yep, this looks to be the identical problem as discussed recently:

http://www.mail-archive.com/linux-ide@vger.kernel.org/msg16131.html

[ + IIRC the similar issue might be already in the kernel bugzilla... ]

 can you try 2.6.25-rc2 - this one should be stable enough and it has the 
 ide-cd
 rewrite in there and it would be interesting to see whether the new interrupt
 handler shows the same behaviour.
 
 Bart, since this starts to occur often, i'm thinking of adding a debugging 
 macro
 similar to the ones we rewrote in ide-floppy and ide-tape besides the
 CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS facility in ide-cd. What are your thoughts
 on the matter?

I would rather prefer to see more code removal/unification in ide-cd.

[ If the code is simple/clean enough and have informative printk()-s for
  error conditions there shouldn't be a frequent need for an extra debugging
  information. ]

  As you can see on the atached file. It's a simple IDE dvdrom and a cd
  burner.
  
  I dont have this problem with the kernel 2.6.21.3
  
  My actual kernel is:
  9:28 [EMAIL PROTECTED] ~% uname -a
  Linux Jupiter 2.6.24.2-waver.1 #1 Wed Feb 13 23:53:31 CET 2008 i686
  GNU/Linux

It would also help us if it can be narrowed down to the specific commit.
Please install git package, get kernel git tree from kernel.org, and do:

git bisect start
git bisect good 2.6.21
git bisect bad 2.6.24

It will select the kernel to test - compile and boot it to see if the problem
is still there.  If so do git bisect bad which will give you new kernel
to test.  If the kernel works fine do git bisect good instead.  After few
iterations you should find the exact commit which introduced the bug.

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Optiarc DVD RW AD-5200A audio playing

2008-02-16 Thread Bartlomiej Zolnierkiewicz
On Saturday 16 February 2008, Borislav Petkov wrote:
 On Sat, Feb 16, 2008 at 04:24:01PM +0100, Bartlomiej Zolnierkiewicz wrote:
  
  Hi,
  
  On Saturday 16 February 2008, Borislav Petkov wrote:
   On Fri, Feb 15, 2008 at 02:53:27PM -0500, Stefan Bader wrote:
Hello Borislav,

I worked on a problem with an DVD driver (model=Optiarc DVD RW AD-5200A)
which obviously has the same problem as some Matshita drives. The
following patch was reported to enabled audio playing on this drive.
Would this approach be suitable for upstream or are there other
solutions to this problem?

Regards,
Stefan

--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -2988,7 +2988,8 @@ int ide_cdrom_probe_capabilities (ide_drive_t 
*drive)
if (strcmp(drive-id-model, MATSHITADVD-ROM SR-8187) == 0 ||
strcmp(drive-id-model, MATSHITADVD-ROM SR-8186) == 0 ||
strcmp(drive-id-model, MATSHITADVD-ROM SR-8176) == 0 ||
-   strcmp(drive-id-model, MATSHITADVD-ROM SR-8174) == 0)
+   strcmp(drive-id-model, MATSHITADVD-ROM SR-8174) == 0 ||
+   strcmp(drive-id-model, Optiarc DVD RW AD-5200A) == 0)
CDROM_CONFIG_FLAGS(drive)-audio_play = 1;

 #if ! STANDARD_ATAPI
   
   Hi Stefan,
   
   just to make sure that the audioplay bit is not set in the capabilities 
   page,
   can you please try the following patch applied against 2.6.25-rc2 and 
   send me
   the output. Thanks!
   
   @Bart: by the way, this cdi-mask thingy is kinda unintuitive doing double
   negation to check whether a feature is supported or not. Yeah, this comes 
   from
   above, i.e. uniform cdrom layer. But still, shouldn't we use a 
   cdi-caps_flags
   or something similar instead, which mirrors the caps page bits setting?
  
  It seems so (at least having negative flags is very unintuitive) but they
  might be some reason for this ugliness, Jens?
  
  [ Please also remember that since cdrom layer is _uniform_ it may be not
possible and/or desirable to have 1-1 mapping between caps page bits
and the future cdi-caps_flags. ]
  
   commit 435f0f4496a1b32af2d542f43b2370a890fe2f83
   Author: Borislav Petkov [EMAIL PROTECTED]
   Date:   Sat Feb 16 09:56:36 2008 +0100
   
   ide-cd: Enable audio play quirk for Optiarc DVD RW AD-5200A drive
   
   Reported-by: Stefan Bader [EMAIL PROTECTED]
   Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
   
   diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
   index f77db6b..2c9d06e 100644
   --- a/drivers/ide/ide-cd.c
   +++ b/drivers/ide/ide-cd.c
   @@ -1750,6 +1750,10 @@ int ide_cdrom_probe_capabilities (ide_drive_t 
   *drive)
 cdi-mask = ~(CDC_DVD_RAM | CDC_RAM);
 if (buf[8 + 3]  0x10)
 cdi-mask = ~CDC_DVD_R;
   + if (!(buf[8 + 4]  0x01)) {
  
  Hmm, shouldn't there be ' (cd-cd_flags  IDE_CD_FLAG_PLAY_AUDIO_OK)'
  to prevent false positives?
 
 I wanted to see whether the caps page reports the audioplay bit off...

we still need IDE_CD_FLAG_PLAY_AUDIO_OK flag to be _set_ to enable the quirk

  
   + printk(KERN_INFO ide-cd: audio play not advertised in caps 
   page,
  
  Would be nice to also printk() the device name.
 
 ... but printing the device model is actually a good idea and this will rule 
 out
 false positives, so Stefan, please drop the previous patch and test the 
 updated
 one below. Thanks.
 
 
 commit 6cc44b0ce5c9270b15d456eb9ffa91b855e4e0d0
 Author: Borislav Petkov [EMAIL PROTECTED]
 Date:   Sat Feb 16 09:56:36 2008 +0100
 
 ide-cd: Enable audio play quirk for Optiarc DVD RW AD-5200A drive
 
 Reported-by: Stefan Bader [EMAIL PROTECTED]
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
 
 diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
 index f77db6b..4c9984f 100644
 --- a/drivers/ide/ide-cd.c
 +++ b/drivers/ide/ide-cd.c
 @@ -1750,6 +1750,11 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
   cdi-mask = ~(CDC_DVD_RAM | CDC_RAM);
   if (buf[8 + 3]  0x10)
   cdi-mask = ~CDC_DVD_R;
 + if (!(buf[8 + 4]  0x01)) {
 + printk(KERN_INFO ide-cd: audio play not advertised in caps 
 + page for drive model [%s], enabling quirk.\n,
 + drive-id-model);

if IDE_CD_FLAG_PLAY_AUDIO_OK flag is not set the above message is _bogus_
(because the quirk won't be enabled)

[ how's about just deleting the whole printk() to preserve simplicity? ]

 + }
   if ((buf[8 + 4]  0x01) || (cd-cd_flags  IDE_CD_FLAG_PLAY_AUDIO_OK))
   cdi-mask = ~CDC_PLAY_AUDIO;
  
 @@ -1929,6 +1934,7 @@ static const struct cd_list_entry ide_cd_quirks_list[] 
 = {
   { MATSHITADVD-ROM SR-8186, NULL,   IDE_CD_FLAG_PLAY_AUDIO_OK  },
   { MATSHITADVD-ROM SR-8176, NULL,   IDE_CD_FLAG_PLAY_AUDIO_OK  },
   { MATSHITADVD-ROM SR-8174, NULL,   IDE_CD_FLAG_PLAY_AUDIO_OK

Re: Optiarc DVD RW AD-5200A audio playing

2008-02-16 Thread Bartlomiej Zolnierkiewicz
On Saturday 16 February 2008, Borislav Petkov wrote:
 On Sat, Feb 16, 2008 at 06:48:24PM +0100, Bartlomiej Zolnierkiewicz wrote:
  On Saturday 16 February 2008, Borislav Petkov wrote:
   On Sat, Feb 16, 2008 at 04:24:01PM +0100, Bartlomiej Zolnierkiewicz wrote:

Hi,

On Saturday 16 February 2008, Borislav Petkov wrote:
 On Fri, Feb 15, 2008 at 02:53:27PM -0500, Stefan Bader wrote:
  Hello Borislav,
  
  I worked on a problem with an DVD driver (model=Optiarc DVD RW 
  AD-5200A)
  which obviously has the same problem as some Matshita drives. The
  following patch was reported to enabled audio playing on this drive.
  Would this approach be suitable for upstream or are there other
  solutions to this problem?
  
  Regards,
  Stefan
  
  --- a/drivers/ide/ide-cd.c
  +++ b/drivers/ide/ide-cd.c
  @@ -2988,7 +2988,8 @@ int ide_cdrom_probe_capabilities (ide_drive_t 
  *drive)
  if (strcmp(drive-id-model, MATSHITADVD-ROM SR-8187) == 0 ||
  strcmp(drive-id-model, MATSHITADVD-ROM SR-8186) == 0 ||
  strcmp(drive-id-model, MATSHITADVD-ROM SR-8176) == 0 ||
  -   strcmp(drive-id-model, MATSHITADVD-ROM SR-8174) == 0)
  +   strcmp(drive-id-model, MATSHITADVD-ROM SR-8174) == 0 ||
  +   strcmp(drive-id-model, Optiarc DVD RW AD-5200A) == 0)
  CDROM_CONFIG_FLAGS(drive)-audio_play = 1;
  
   #if ! STANDARD_ATAPI
 
 Hi Stefan,
 
 just to make sure that the audioplay bit is not set in the 
 capabilities page,
 can you please try the following patch applied against 2.6.25-rc2 and 
 send me
 the output. Thanks!
 
 @Bart: by the way, this cdi-mask thingy is kinda unintuitive doing 
 double
 negation to check whether a feature is supported or not. Yeah, this 
 comes from
 above, i.e. uniform cdrom layer. But still, shouldn't we use a 
 cdi-caps_flags
 or something similar instead, which mirrors the caps page bits 
 setting?

It seems so (at least having negative flags is very unintuitive) but 
they
might be some reason for this ugliness, Jens?

[ Please also remember that since cdrom layer is _uniform_ it may be not
  possible and/or desirable to have 1-1 mapping between caps page bits
  and the future cdi-caps_flags. ]

 commit 435f0f4496a1b32af2d542f43b2370a890fe2f83
 Author: Borislav Petkov [EMAIL PROTECTED]
 Date:   Sat Feb 16 09:56:36 2008 +0100
 
 ide-cd: Enable audio play quirk for Optiarc DVD RW AD-5200A drive
 
 Reported-by: Stefan Bader [EMAIL PROTECTED]
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
 
 diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
 index f77db6b..2c9d06e 100644
 --- a/drivers/ide/ide-cd.c
 +++ b/drivers/ide/ide-cd.c
 @@ -1750,6 +1750,10 @@ int ide_cdrom_probe_capabilities (ide_drive_t 
 *drive)
   cdi-mask = ~(CDC_DVD_RAM | CDC_RAM);
   if (buf[8 + 3]  0x10)
   cdi-mask = ~CDC_DVD_R;
 + if (!(buf[8 + 4]  0x01)) {

Hmm, shouldn't there be ' (cd-cd_flags  IDE_CD_FLAG_PLAY_AUDIO_OK)'
to prevent false positives?
   
   I wanted to see whether the caps page reports the audioplay bit off...
  
  we still need IDE_CD_FLAG_PLAY_AUDIO_OK flag to be _set_ to enable the quirk
  

 + printk(KERN_INFO ide-cd: audio play not advertised in 
 caps page,

Would be nice to also printk() the device name.
   
   ... but printing the device model is actually a good idea and this will 
   rule out
   false positives, so Stefan, please drop the previous patch and test the 
   updated
   one below. Thanks.
   
   
   commit 6cc44b0ce5c9270b15d456eb9ffa91b855e4e0d0
   Author: Borislav Petkov [EMAIL PROTECTED]
   Date:   Sat Feb 16 09:56:36 2008 +0100
   
   ide-cd: Enable audio play quirk for Optiarc DVD RW AD-5200A drive
   
   Reported-by: Stefan Bader [EMAIL PROTECTED]
   Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
   
   diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
   index f77db6b..4c9984f 100644
   --- a/drivers/ide/ide-cd.c
   +++ b/drivers/ide/ide-cd.c
   @@ -1750,6 +1750,11 @@ int ide_cdrom_probe_capabilities (ide_drive_t 
   *drive)
 cdi-mask = ~(CDC_DVD_RAM | CDC_RAM);
 if (buf[8 + 3]  0x10)
 cdi-mask = ~CDC_DVD_R;
   + if (!(buf[8 + 4]  0x01)) {
   + printk(KERN_INFO ide-cd: audio play not advertised in caps 
   + page for drive model [%s], enabling quirk.\n,
   + drive-id-model);
  
  if IDE_CD_FLAG_PLAY_AUDIO_OK flag is not set the above message is _bogus_
  (because the quirk won't be enabled)
  
  [ how's about just deleting the whole printk() to preserve simplicity? ]
  
   + }
 if ((buf[8 + 4]  0x01) || (cd-cd_flags  IDE_CD_FLAG_PLAY_AUDIO_OK

Re: [PATCH 5/13] cy82c693: add -set_dma_mode method

2008-02-16 Thread Bartlomiej Zolnierkiewicz

[ Sorry for the late reply. ]

On Friday 04 January 2008, Sergei Shtylyov wrote:
 Bartlomiej Zolnierkiewicz wrote:
 
  * Fix SWDMA/MWDMA masks in cy82c693_chipset.
 
  * Add IDE_HFLAG_CY82C693 host flag and use it in ide_tune_dma() to
check whether the DMA should be enabled even if ide_max_dma_mode()
fails.
 
 I didn't get why this was necessary...

paranoia ;-)

Care to send a patch removing it?

  * Convert cy82c693_dma_enable() to become cy82c693_set_dma_mode()
and remove no longer needed cy82c693_ide_dma_on().  Then set
IDE_HFLAG_CY82C693 instead of IDE_HFLAG_TRUST_BIOS_FOR_DMA in
cy82c693_chipset.
 
  * Bump driver version.
 
  As a result of this patch cy82c693 driver will configure and use DMA on
  all SWDMA0-2 and MWDMA0-2 capable ATA devices instead of relying on BIOS.
 
  Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
 
 
  Index: b/drivers/ide/pci/cy82c693.c
  ===
  --- a/drivers/ide/pci/cy82c693.c
  +++ b/drivers/ide/pci/cy82c693.c
  @@ -1,5 +1,5 @@
   /*
  - * linux/drivers/ide/pci/cy82c693.cVersion 0.43Nov 7, 
  2007
  + * linux/drivers/ide/pci/cy82c693.cVersion 0.44Nov 8, 
  2007
*
*  Copyright (C) 1998-2000 Andreas S. Krebs ([EMAIL PROTECTED]), 
  Maintainer
*  Copyright (C) 1998-2002 Andre Hedrick [EMAIL PROTECTED], Integrator
  @@ -176,14 +176,12 @@ static void compute_clocks (u8 pio, pio_
* set DMA mode a specific channel for CY82C693
*/
   
  -static void cy82c693_dma_enable (ide_drive_t *drive, int mode, int single)
  +static void cy82c693_set_dma_mode(ide_drive_t *drive, const u8 mode)
   {
  -   u8 index = 0, data = 0;
  +   ide_hwif_t *hwif = drive-hwif;
  +   u8 single = (mode  0x10)  4, index = 0, data = 0;
 
 Useless intializers for 'index' and 'data'.

ditto

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] ide-pmac: use ide_find_port()

2008-02-16 Thread Bartlomiej Zolnierkiewicz
Cc: Benjamin Herrenschmidt [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ppc/pmac.c |   44 +++-
 1 file changed, 19 insertions(+), 25 deletions(-)

Index: b/drivers/ide/ppc/pmac.c
===
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1086,38 +1086,34 @@ pmac_ide_macio_attach(struct macio_dev *
 {
void __iomem *base;
unsigned long regbase;
-   int irq;
ide_hwif_t *hwif;
pmac_ide_hwif_t *pmif;
-   int i, rc;
+   int irq, rc;
hw_regs_t hw;
 
pmif = (struct pmac_ide_hwif)kzalloc(sizeof(*pmif), GFP_KERNEL);
if (pmif == NULL)
return -ENOMEM;
 
-   i = 0;
-   while (i  MAX_HWIFS  (ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0))
-   ++i;
-   if (i = MAX_HWIFS) {
+   hwif = ide_find_port();
+   if (hwif == NULL) {
printk(KERN_ERR ide-pmac: MacIO interface attach with no 
slot\n);
printk(KERN_ERR   %s\n, mdev-ofdev.node-full_name);
rc = -ENODEV;
goto out_free_pmif;
}
 
-   hwif = ide_hwifs[i];
-
if (macio_resource_count(mdev) == 0) {
-   printk(KERN_WARNING ide%d: no address for %s\n,
-  i, mdev-ofdev.node-full_name);
+   printk(KERN_WARNING ide-pmac: no address for %s\n,
+   mdev-ofdev.node-full_name);
rc = -ENXIO;
goto out_free_pmif;
}
 
/* Request memory resource for IO ports */
if (macio_request_resource(mdev, 0, ide-pmac (ports))) {
-   printk(KERN_ERR ide%d: can't request mmio resource !\n, i);
+   printk(KERN_ERR ide-pmac: can't request MMIO resource for 
+   %s!\n, mdev-ofdev.node-full_name);
rc = -EBUSY;
goto out_free_pmif;
}
@@ -1128,8 +1124,8 @@ pmac_ide_macio_attach(struct macio_dev *
 * where that happens though...
 */
if (macio_irq_count(mdev) == 0) {
-   printk(KERN_WARNING ide%d: no intrs for device %s, using 13\n,
-   i, mdev-ofdev.node-full_name);
+   printk(KERN_WARNING ide-pmac: no intrs for device %s, using 
+   13\n, mdev-ofdev.node-full_name);
irq = irq_create_mapping(NULL, 13);
} else
irq = macio_irq(mdev, 0);
@@ -1147,7 +1143,9 @@ pmac_ide_macio_attach(struct macio_dev *
 #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
if (macio_resource_count(mdev) = 2) {
if (macio_request_resource(mdev, 1, ide-pmac (dma)))
-   printk(KERN_WARNING ide%d: can't request DMA resource 
!\n, i);
+   printk(KERN_WARNING ide-pmac: can't request DMA 
+   resource for %s!\n,
+   mdev-ofdev.node-full_name);
else
pmif-dma_regs = ioremap(macio_resource_start(mdev, 1), 
0x1000);
} else
@@ -1222,7 +1220,7 @@ pmac_ide_pci_attach(struct pci_dev *pdev
pmac_ide_hwif_t *pmif;
void __iomem *base;
unsigned long rbase, rlen;
-   int i, rc;
+   int rc;
hw_regs_t hw;
 
np = pci_device_to_OF_node(pdev);
@@ -1235,29 +1233,25 @@ pmac_ide_pci_attach(struct pci_dev *pdev
if (pmif == NULL)
return -ENOMEM;
 
-   i = 0;
-   while (i  MAX_HWIFS  (ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0))
-   ++i;
-   if (i = MAX_HWIFS) {
+   hwif = ide_find_port();
+   if (hwif == NULL) {
printk(KERN_ERR ide-pmac: PCI interface attach with no 
slot\n);
printk(KERN_ERR   %s\n, np-full_name);
rc = -ENODEV;
goto out_free_pmif;
}
 
-   hwif = ide_hwifs[i];
-
if (pci_enable_device(pdev)) {
-   printk(KERN_WARNING ide%i: Can't enable PCI device for %s\n,
-   i, np-full_name);
+   printk(KERN_WARNING ide-pmac: Can't enable PCI device for 
+   %s\n, np-full_name);
rc = -ENXIO;
goto out_free_pmif;
}
pci_set_master(pdev);

if (pci_request_regions(pdev, Kauai ATA)) {
-   printk(KERN_ERR ide%d: Cannot obtain PCI resources for %s\n,
-   i, np-full_name);
+   printk(KERN_ERR ide-pmac: Cannot obtain PCI resources for 
+   %s\n, np-full_name);
rc = -ENXIO;
goto out_free_pmif;
}
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info

[PATCH 1/2] ide-pmac: dynamically allocate struct pmac_ide_hwif instances

2008-02-16 Thread Bartlomiej Zolnierkiewicz
Dynamically allocate struct pmac_ide_hwif instances in pmac_ide_macio_attach()
and pmac_ide_pci_attach(), then remove no longer needed pmac_ide[].

Cc: Benjamin Herrenschmidt [EMAIL PROTECTED]
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/ppc/pmac.c |   49 +
 1 file changed, 33 insertions(+), 16 deletions(-)

Index: b/drivers/ide/ppc/pmac.c
===
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -79,8 +79,6 @@ typedef struct pmac_ide_hwif {

 } pmac_ide_hwif_t;
 
-static pmac_ide_hwif_t pmac_ide[MAX_HWIFS];
-
 enum {
controller_ohare,   /* OHare based */
controller_heathrow,/* Heathrow/Paddington */
@@ -1094,29 +1092,34 @@ pmac_ide_macio_attach(struct macio_dev *
int i, rc;
hw_regs_t hw;
 
+   pmif = (struct pmac_ide_hwif)kzalloc(sizeof(*pmif), GFP_KERNEL);
+   if (pmif == NULL)
+   return -ENOMEM;
+
i = 0;
-   while (i  MAX_HWIFS  (ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0
-   || pmac_ide[i].node != NULL))
+   while (i  MAX_HWIFS  (ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0))
++i;
if (i = MAX_HWIFS) {
printk(KERN_ERR ide-pmac: MacIO interface attach with no 
slot\n);
printk(KERN_ERR   %s\n, mdev-ofdev.node-full_name);
-   return -ENODEV;
+   rc = -ENODEV;
+   goto out_free_pmif;
}
 
-   pmif = pmac_ide[i];
hwif = ide_hwifs[i];
 
if (macio_resource_count(mdev) == 0) {
printk(KERN_WARNING ide%d: no address for %s\n,
   i, mdev-ofdev.node-full_name);
-   return -ENXIO;
+   rc = -ENXIO;
+   goto out_free_pmif;
}
 
/* Request memory resource for IO ports */
if (macio_request_resource(mdev, 0, ide-pmac (ports))) {
printk(KERN_ERR ide%d: can't request mmio resource !\n, i);
-   return -EBUSY;
+   rc = -EBUSY;
+   goto out_free_pmif;
}

/* XXX This is bogus. Should be fixed in the registry by checking
@@ -1166,11 +1169,15 @@ pmac_ide_macio_attach(struct macio_dev *
iounmap(pmif-dma_regs);
macio_release_resource(mdev, 1);
}
-   memset(pmif, 0, sizeof(*pmif));
macio_release_resource(mdev, 0);
+   kfree(pmif);
}
 
return rc;
+
+out_free_pmif:
+   kfree(pmif);
+   return rc;
 }
 
 static int
@@ -1223,30 +1230,36 @@ pmac_ide_pci_attach(struct pci_dev *pdev
printk(KERN_ERR ide-pmac: cannot find MacIO node for Kauai ATA 
interface\n);
return -ENODEV;
}
+
+   pmif = (struct pmac_ide_hwif)kzalloc(sizeof(*pmif), GFP_KERNEL);
+   if (pmif == NULL)
+   return -ENOMEM;
+
i = 0;
-   while (i  MAX_HWIFS  (ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0
-   || pmac_ide[i].node != NULL))
+   while (i  MAX_HWIFS  (ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0))
++i;
if (i = MAX_HWIFS) {
printk(KERN_ERR ide-pmac: PCI interface attach with no 
slot\n);
printk(KERN_ERR   %s\n, np-full_name);
-   return -ENODEV;
+   rc = -ENODEV;
+   goto out_free_pmif;
}
 
-   pmif = pmac_ide[i];
hwif = ide_hwifs[i];
 
if (pci_enable_device(pdev)) {
printk(KERN_WARNING ide%i: Can't enable PCI device for %s\n,
i, np-full_name);
-   return -ENXIO;
+   rc = -ENXIO;
+   goto out_free_pmif;
}
pci_set_master(pdev);

if (pci_request_regions(pdev, Kauai ATA)) {
printk(KERN_ERR ide%d: Cannot obtain PCI resources for %s\n,
i, np-full_name);
-   return -ENXIO;
+   rc = -ENXIO;
+   goto out_free_pmif;
}
 
hwif-dev = pdev-dev;
@@ -1276,11 +1289,15 @@ pmac_ide_pci_attach(struct pci_dev *pdev
/* The inteface is released to the common IDE layer */
pci_set_drvdata(pdev, NULL);
iounmap(base);
-   memset(pmif, 0, sizeof(*pmif));
pci_release_regions(pdev);
+   kfree(pmif);
}
 
return rc;
+
+out_free_pmif:
+   kfree(pmif);
+   return rc;
 }
 
 static int
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Optiarc DVD RW AD-5200A audio playing

2008-02-16 Thread Bartlomiej Zolnierkiewicz
On Saturday 16 February 2008, Borislav Petkov wrote:
 On Sat, Feb 16, 2008 at 07:23:58PM +0100, Bartlomiej Zolnierkiewicz wrote:
  On Saturday 16 February 2008, Borislav Petkov wrote:
   On Sat, Feb 16, 2008 at 06:48:24PM +0100, Bartlomiej Zolnierkiewicz wrote:
On Saturday 16 February 2008, Borislav Petkov wrote:
 On Sat, Feb 16, 2008 at 04:24:01PM +0100, Bartlomiej Zolnierkiewicz 
 wrote:
  
  Hi,
  
  On Saturday 16 February 2008, Borislav Petkov wrote:
   On Fri, Feb 15, 2008 at 02:53:27PM -0500, Stefan Bader wrote:
Hello Borislav,

I worked on a problem with an DVD driver (model=Optiarc DVD RW 
AD-5200A)
which obviously has the same problem as some Matshita drives. 
The
following patch was reported to enabled audio playing on this 
drive.
Would this approach be suitable for upstream or are there other
solutions to this problem?

Regards,
Stefan

--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -2988,7 +2988,8 @@ int ide_cdrom_probe_capabilities 
(ide_drive_t *drive)
if (strcmp(drive-id-model, MATSHITADVD-ROM SR-8187) 
== 0 ||
strcmp(drive-id-model, MATSHITADVD-ROM SR-8186) 
== 0 ||
strcmp(drive-id-model, MATSHITADVD-ROM SR-8176) 
== 0 ||
-   strcmp(drive-id-model, MATSHITADVD-ROM SR-8174) 
== 0)
+   strcmp(drive-id-model, MATSHITADVD-ROM SR-8174) 
== 0 ||
+   strcmp(drive-id-model, Optiarc DVD RW AD-5200A) 
== 0)
CDROM_CONFIG_FLAGS(drive)-audio_play = 1;

 #if ! STANDARD_ATAPI
   
   Hi Stefan,
   
   just to make sure that the audioplay bit is not set in the 
   capabilities page,
   can you please try the following patch applied against 2.6.25-rc2 
   and send me
   the output. Thanks!
   
   @Bart: by the way, this cdi-mask thingy is kinda unintuitive 
   doing double
   negation to check whether a feature is supported or not. Yeah, 
   this comes from
   above, i.e. uniform cdrom layer. But still, shouldn't we use a 
   cdi-caps_flags
   or something similar instead, which mirrors the caps page bits 
   setting?
  
  It seems so (at least having negative flags is very unintuitive) 
  but they
  might be some reason for this ugliness, Jens?
  
  [ Please also remember that since cdrom layer is _uniform_ it may 
  be not
possible and/or desirable to have 1-1 mapping between caps page 
  bits
and the future cdi-caps_flags. ]
  
   commit 435f0f4496a1b32af2d542f43b2370a890fe2f83
   Author: Borislav Petkov [EMAIL PROTECTED]
   Date:   Sat Feb 16 09:56:36 2008 +0100
   
   ide-cd: Enable audio play quirk for Optiarc DVD RW AD-5200A 
   drive
   
   Reported-by: Stefan Bader [EMAIL PROTECTED]
   Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
   
   diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
   index f77db6b..2c9d06e 100644
   --- a/drivers/ide/ide-cd.c
   +++ b/drivers/ide/ide-cd.c
   @@ -1750,6 +1750,10 @@ int ide_cdrom_probe_capabilities 
   (ide_drive_t *drive)
 cdi-mask = ~(CDC_DVD_RAM | CDC_RAM);
 if (buf[8 + 3]  0x10)
 cdi-mask = ~CDC_DVD_R;
   + if (!(buf[8 + 4]  0x01)) {
  
  Hmm, shouldn't there be ' (cd-cd_flags  
  IDE_CD_FLAG_PLAY_AUDIO_OK)'
  to prevent false positives?
 
 I wanted to see whether the caps page reports the audioplay bit off...

we still need IDE_CD_FLAG_PLAY_AUDIO_OK flag to be _set_ to enable the 
quirk

  
   + printk(KERN_INFO ide-cd: audio play not advertised in 
   caps page,
  
  Would be nice to also printk() the device name.
 
 ... but printing the device model is actually a good idea and this 
 will rule out
 false positives, so Stefan, please drop the previous patch and test 
 the updated
 one below. Thanks.
 
 
 commit 6cc44b0ce5c9270b15d456eb9ffa91b855e4e0d0
 Author: Borislav Petkov [EMAIL PROTECTED]
 Date:   Sat Feb 16 09:56:36 2008 +0100
 
 ide-cd: Enable audio play quirk for Optiarc DVD RW AD-5200A drive
 
 Reported-by: Stefan Bader [EMAIL PROTECTED]
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
 
 diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
 index f77db6b..4c9984f 100644
 --- a/drivers/ide/ide-cd.c
 +++ b/drivers/ide/ide-cd.c
 @@ -1750,6 +1750,11 @@ int ide_cdrom_probe_capabilities (ide_drive_t 
 *drive)
   cdi-mask = ~(CDC_DVD_RAM | CDC_RAM);
   if (buf[8 + 3]  0x10)
   cdi-mask = ~CDC_DVD_R

[PATCH 6/9] umc8672: don't use ide_hwifs[] in umc_set_pio_mode()

2008-02-16 Thread Bartlomiej Zolnierkiewicz
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/legacy/umc8672.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: b/drivers/ide/legacy/umc8672.c
===
--- a/drivers/ide/legacy/umc8672.c
+++ b/drivers/ide/legacy/umc8672.c
@@ -105,13 +105,13 @@ static void umc_set_speeds (u8 speeds[])
 
 static void umc_set_pio_mode(ide_drive_t *drive, const u8 pio)
 {
+   ide_hwif_t *hwif = drive-hwif;
unsigned long flags;
-   ide_hwgroup_t *hwgroup = ide_hwifs[HWIF(drive)-index^1].hwgroup;
 
printk(%s: setting umc8672 to PIO mode%d (speed %d)\n,
drive-name, pio, pio_to_umc[pio]);
spin_lock_irqsave(ide_lock, flags);
-   if (hwgroup  hwgroup-handler != NULL) {
+   if (hwif-mate  hwif-mate-hwgroup-handler) {
printk(KERN_ERR umc8672: other interface is busy: exiting 
tune_umc()\n);
} else {
current_speeds[drive-name[2] - 'a'] = pio_to_umc[pio];
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/9] scc_pata: store 'hwif' pointer in struct scc_ports

2008-02-16 Thread Bartlomiej Zolnierkiewicz
Replace 'unsigned char hwif_id' by 'ide_hwif_t *hwif' in struct scc_ports.
This allows us to remove ide_hwifs[] usage from scc_remove().

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/pci/scc_pata.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: b/drivers/ide/pci/scc_pata.c
===
--- a/drivers/ide/pci/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
@@ -65,7 +65,7 @@
 
 static struct scc_ports {
unsigned long ctl, dma;
-   unsigned char hwif_id;  /* for removing hwif from system */
+   ide_hwif_t *hwif;  /* for removing port from system */
 } scc_ports[MAX_HWIFS];
 
 /* PIO transfer mode  table */
@@ -664,7 +664,7 @@ static void __devinit init_hwif_scc(ide_
 {
struct scc_ports *ports = ide_get_hwifdata(hwif);
 
-   ports-hwif_id = hwif-index;
+   ports-hwif = hwif;
 
hwif-dma_command = hwif-dma_base;
hwif-dma_status = hwif-dma_base + 0x04;
@@ -726,7 +726,7 @@ static int __devinit scc_init_one(struct
 static void __devexit scc_remove(struct pci_dev *dev)
 {
struct scc_ports *ports = pci_get_drvdata(dev);
-   ide_hwif_t *hwif = ide_hwifs[ports-hwif_id];
+   ide_hwif_t *hwif = ports-hwif;
unsigned long ctl_base = pci_resource_start(dev, 0);
unsigned long dma_base = pci_resource_start(dev, 1);
unsigned long ctl_size = pci_resource_len(dev, 0);
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/9] cmd640: use ide_find_port()

2008-02-16 Thread Bartlomiej Zolnierkiewicz
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/pci/cmd640.c |   30 ++
 1 file changed, 18 insertions(+), 12 deletions(-)

Index: b/drivers/ide/pci/cmd640.c
===
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -744,20 +744,21 @@ static int __init cmd640x_init(void)
printk(KERN_INFO cmd640: buggy cmd640%c interface on %s, config=0x%02x
 \n, 'a' + cmd640_chip_version - 1, bus_type, cfr);
 
-   cmd_hwif0 = ide_hwifs[0];
-   cmd_hwif1 = ide_hwifs[1];
+   cmd_hwif0 = ide_find_port();
 
/*
 * Initialize data for primary port
 */
-   oldnoprobe = cmd_hwif0-noprobe;
-   ide_init_port_hw(cmd_hwif0, hw[0]);
-   cmd_hwif0-noprobe = oldnoprobe;
+   if (cmd_hwif0) {
+   oldnoprobe = cmd_hwif0-noprobe;
+   ide_init_port_hw(cmd_hwif0, hw[0]);
+   cmd_hwif0-noprobe = oldnoprobe;
 #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
-   cmd_hwif0-set_pio_mode = cmd640_set_pio_mode;
+   cmd_hwif0-set_pio_mode = cmd640_set_pio_mode;
 #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
 
-   idx[0] = cmd_hwif0-index;
+   idx[0] = cmd_hwif0-index;
+   }
 
/*
 * Ensure compatibility by always using the slowest timings
@@ -772,7 +773,7 @@ static int __init cmd640x_init(void)
/*
 * Try to enable the secondary interface, if not already enabled
 */
-   if (cmd_hwif1-noprobe) {
+   if (cmd_hwif1  cmd_hwif1-noprobe) {
port2 = not probed;
} else {
b = get_cmd640_reg(CNTRL);
@@ -803,7 +804,7 @@ static int __init cmd640x_init(void)
/*
 * Initialize data for secondary cmd640 port, if enabled
 */
-   if (second_port_cmd640) {
+   if (second_port_cmd640  cmd_hwif1) {
oldnoprobe = cmd_hwif1-noprobe;
ide_init_port_hw(cmd_hwif1, hw[1]);
cmd_hwif1-noprobe = oldnoprobe;
@@ -813,7 +814,7 @@ static int __init cmd640x_init(void)
 
idx[1] = cmd_hwif1-index;
}
-   printk(KERN_INFO %s: %sserialized, secondary interface %s\n, 
cmd_hwif1-name,
+   printk(KERN_INFO cmd640: %sserialized, secondary interface %s\n,
 second_port_cmd640 ?  : not , port2);
 
/*
@@ -823,10 +824,15 @@ static int __init cmd640x_init(void)
for (index = 0; index  (2 + (second_port_cmd640  1)); index++) {
ide_drive_t *drive;
 
-   if (index  1)
+   if (index  1) {
+   if (cmd_hwif1 == NULL)
+   continue;
drive = cmd_hwif1-drives[index  1];
-   else
+   } else  {
+   if (cmd_hwif0 == NULL)
+   continue;
drive = cmd_hwif0-drives[index  1];
+   }
 
 #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
if (drive-autotune || ((index  1)  second_port_toggled)) {
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 8/9] qd65xx: return error value in qd_probe()

2008-02-16 Thread Bartlomiej Zolnierkiewicz
Return error value in qd_probe() and use it in qd65xx_init()
instead of checking ide_hwifs[].chipset.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/legacy/qd65xx.c |   25 +++--
 1 file changed, 15 insertions(+), 10 deletions(-)

Index: b/drivers/ide/legacy/qd65xx.c
===
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -396,7 +396,7 @@ static int __init qd_probe(int base)
config = inb(QD_CONFIG_PORT);
 
if (! ((config  QD_CONFIG_BASEPORT)  1 == (base == 0xb0)) )
-   return 1;
+   return -ENODEV;
 
unit = ! (config  QD_CONFIG_IDE_BASEPORT);
 
@@ -410,7 +410,8 @@ static int __init qd_probe(int base)
 
if ((config  0xf0) == QD_CONFIG_QD6500) {
 
-   if (qd_testreg(base)) return 1; /* bad register */
+   if (qd_testreg(base))
+return -ENODEV;/* bad register */
 
/* qd6500 found */
 
@@ -421,7 +422,7 @@ static int __init qd_probe(int base)

if (config  QD_CONFIG_DISABLED) {
printk(KERN_WARNING qd6500 is disabled !\n);
-   return 1;
+   return -ENODEV;
}
 
ide_init_port_hw(hwif, hw[unit]);
@@ -443,8 +444,8 @@ static int __init qd_probe(int base)
 
u8 control;
 
-   if (qd_testreg(base) || qd_testreg(base+0x02)) return 1;
-   /* bad registers */
+   if (qd_testreg(base) || qd_testreg(base + 0x02))
+   return -ENODEV; /* bad registers */
 
/* qd6580 found */
 
@@ -508,7 +509,7 @@ static int __init qd_probe(int base)
}
}
/* no qd65xx found */
-   return 1;
+   return -ENODEV;
 }
 
 int probe_qd65xx = 0;
@@ -518,14 +519,18 @@ MODULE_PARM_DESC(probe, probe for QD65x
 
 static int __init qd65xx_init(void)
 {
+   int rc1, rc2 = -ENODEV;
+
if (probe_qd65xx == 0)
return -ENODEV;
 
-   if (qd_probe(0x30))
-   qd_probe(0xb0);
-   if (ide_hwifs[0].chipset != ide_qd65xx 
-   ide_hwifs[1].chipset != ide_qd65xx)
+   rc1 = qd_probe(0x30);
+   if (rc1)
+   rc2 = qd_probe(0xb0);
+
+   if (rc1  0  rc2  0)
return -ENODEV;
+
return 0;
 }
 
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/9] ht6560b: use driver name for resource allocation

2008-02-16 Thread Bartlomiej Zolnierkiewicz
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/legacy/ht6560b.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: b/drivers/ide/legacy/ht6560b.c
===
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -32,6 +32,7 @@
  *  Try:  http://www.maf.iki.fi/~maf/ht6560b/
  */
 
+#define DRV_NAME   ht6560b
 #define HT6560B_VERSION v0.07
 
 #include linux/module.h
@@ -339,7 +340,7 @@ static int __init ht6560b_init(void)
hwif = ide_hwifs[0];
mate = ide_hwifs[1];
 
-   if (!request_region(HT_CONFIG_PORT, 1, hwif-name)) {
+   if (!request_region(HT_CONFIG_PORT, 1, DRV_NAME)) {
printk(KERN_NOTICE %s: HT_CONFIG_PORT not found\n,
__FUNCTION__);
return -ENODEV;
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/9] sgiioc4: use ide_find_port()

2008-02-16 Thread Bartlomiej Zolnierkiewicz
There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/pci/sgiioc4.c |   12 ++--
 1 file changed, 2 insertions(+), 10 deletions(-)

Index: b/drivers/ide/pci/sgiioc4.c
===
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -591,20 +591,12 @@ sgiioc4_ide_setup_pci_device(struct pci_
unsigned long bar0, cmd_phys_base, ctl;
void __iomem *virt_base;
ide_hwif_t *hwif;
-   int h;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
hw_regs_t hw;
struct ide_port_info d = sgiioc4_port_info;
 
-   /*
-* Find an empty HWIF; if none available, return -ENOMEM.
-*/
-   for (h = 0; h  MAX_HWIFS; ++h) {
-   hwif = ide_hwifs[h];
-   if (hwif-chipset == ide_unknown)
-   break;
-   }
-   if (h == MAX_HWIFS) {
+   hwif = ide_find_port();
+   if (hwif == NULL) {
printk(KERN_ERR %s: too many IDE interfaces, no room in 
table\n,
DRV_NAME);
return -ENOMEM;
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 9/9] ide: IDE_HFLAG_BOOTABLE - IDE_HFLAG_NON_BOOTABLE

2008-02-16 Thread Bartlomiej Zolnierkiewicz
bootable should be the default behavior so replace
IDE_HFLAG_BOOTABLE host flag with IDE_HFLAG_NON_BOOTABLE.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/pci/aec62xx.c |3 ++-
 drivers/ide/pci/alim15x3.c|1 -
 drivers/ide/pci/amd74xx.c |3 +--
 drivers/ide/pci/atiixp.c  |5 ++---
 drivers/ide/pci/cmd64x.c  |9 -
 drivers/ide/pci/cs5520.c  |3 +--
 drivers/ide/pci/cs5530.c  |3 +--
 drivers/ide/pci/cs5535.c  |2 +-
 drivers/ide/pci/cy82c693.c|3 +--
 drivers/ide/pci/generic.c |6 ++
 drivers/ide/pci/hpt34x.c  |2 +-
 drivers/ide/pci/hpt366.c  |2 +-
 drivers/ide/pci/it8213.c  |3 +--
 drivers/ide/pci/it821x.c  |1 -
 drivers/ide/pci/jmicron.c |1 -
 drivers/ide/pci/ns87415.c |3 +--
 drivers/ide/pci/opti621.c |6 ++
 drivers/ide/pci/piix.c|4 ++--
 drivers/ide/pci/rz1000.c  |2 +-
 drivers/ide/pci/sc1200.c  |3 +--
 drivers/ide/pci/scc_pata.c|3 +--
 drivers/ide/pci/serverworks.c |5 ++---
 drivers/ide/pci/siimage.c |1 -
 drivers/ide/pci/sis5513.c |3 +--
 drivers/ide/pci/sl82c105.c|3 +--
 drivers/ide/pci/slc90e66.c|2 +-
 drivers/ide/pci/triflex.c |1 -
 drivers/ide/pci/trm290.c  |1 -
 drivers/ide/pci/via82cxxx.c   |3 +--
 drivers/ide/setup-pci.c   |2 +-
 include/linux/ide.h   |8 
 31 files changed, 37 insertions(+), 60 deletions(-)

Index: b/drivers/ide/pci/aec62xx.c
===
--- a/drivers/ide/pci/aec62xx.c
+++ b/drivers/ide/pci/aec62xx.c
@@ -220,7 +220,8 @@ static const struct ide_port_info aec62x
.init_hwif  = init_hwif_aec62xx,
.enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
.host_flags = IDE_HFLAG_NO_ATAPI_DMA |
- IDE_HFLAG_ABUSE_SET_DMA_MODE,
+ IDE_HFLAG_ABUSE_SET_DMA_MODE |
+ IDE_HFLAG_NON_BOOTABLE,
.pio_mask   = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2,
.udma_mask  = ATA_UDMA4,
Index: b/drivers/ide/pci/alim15x3.c
===
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -750,7 +750,6 @@ static const struct ide_port_info ali15x
.init_chipset   = init_chipset_ali15x3,
.init_hwif  = init_hwif_ali15x3,
.init_dma   = init_dma_ali15x3,
-   .host_flags = IDE_HFLAG_BOOTABLE,
.pio_mask   = ATA_PIO5,
.swdma_mask = ATA_SWDMA2,
.mwdma_mask = ATA_MWDMA2,
Index: b/drivers/ide/pci/amd74xx.c
===
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -223,8 +223,7 @@ static void __devinit init_hwif_amd74xx(
 IDE_HFLAG_ABUSE_SET_DMA_MODE | \
 IDE_HFLAG_POST_SET_MODE | \
 IDE_HFLAG_IO_32BIT | \
-IDE_HFLAG_UNMASK_IRQS | \
-IDE_HFLAG_BOOTABLE)
+IDE_HFLAG_UNMASK_IRQS)
 
 #define DECLARE_AMD_DEV(name_str, swdma, udma) \
{   \
Index: b/drivers/ide/pci/atiixp.c
===
--- a/drivers/ide/pci/atiixp.c
+++ b/drivers/ide/pci/atiixp.c
@@ -151,7 +151,7 @@ static const struct ide_port_info atiixp
.name   = ATIIXP,
.init_hwif  = init_hwif_atiixp,
.enablebits = {{0x48,0x01,0x00}, {0x48,0x08,0x00}},
-   .host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_BOOTABLE,
+   .host_flags = IDE_HFLAG_LEGACY_IRQS,
.pio_mask   = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2,
.udma_mask  = ATA_UDMA5,
@@ -159,8 +159,7 @@ static const struct ide_port_info atiixp
.name   = SB600_PATA,
.init_hwif  = init_hwif_atiixp,
.enablebits = {{0x48,0x01,0x00}, {0x00,0x00,0x00}},
-   .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_LEGACY_IRQS |
- IDE_HFLAG_BOOTABLE,
+   .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_LEGACY_IRQS,
.pio_mask   = ATA_PIO4,
.mwdma_mask = ATA_MWDMA2,
.udma_mask  = ATA_UDMA5,
Index: b/drivers/ide/pci/cmd64x.c
===
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -440,8 +440,7 @@ static const struct ide_port_info cmd64x
.init_hwif  = init_hwif_cmd64x,
.enablebits

[PATCH 2/9] au1xxx-ide: use ide_find_port()

2008-02-16 Thread Bartlomiej Zolnierkiewicz
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/mips/au1xxx-ide.c |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

Index: b/drivers/ide/mips/au1xxx-ide.c
===
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -603,9 +603,11 @@ static int au_ide_probe(struct device *d
goto out;
}
 
-   /* FIXME:  This might possibly break PCMCIA IDE devices */
-
-   hwif= ide_hwifs[pdev-id];
+   hwif = ide_find_port();
+   if (hwif == NULL) {
+   ret = -ENOENT;
+   goto out;
+   }
 
memset(hw, 0, sizeof(hw));
auide_setup_ports(hw, ahwif);
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/9] cmd640: remove cmd_drives[]

2008-02-16 Thread Bartlomiej Zolnierkiewicz
* Pass 'ide_drive_t *drive' to check_prefetch(), set_prefetch_mode(),
  program_drive_counts() and cmd640_set_mode().

* Remove no longer needed cmd_drives[].

* Inline setup_device_ptrs() helper in cmd640x_init().

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/pci/cmd640.c |   67 ++-
 1 file changed, 27 insertions(+), 40 deletions(-)

Index: b/drivers/ide/pci/cmd640.c
===
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -185,7 +185,6 @@ static DEFINE_SPINLOCK(cmd640_lock);
  * These are initialized to point at the devices we control
  */
 static ide_hwif_t  *cmd_hwif0, *cmd_hwif1;
-static ide_drive_t *cmd_drives[4];
 
 /*
  * Interface to access cmd640x registers
@@ -386,9 +385,8 @@ static void cmd640_dump_regs (void)
  * Check whether prefetch is on for a drive,
  * and initialize the unmask flags for safe operation.
  */
-static void __init check_prefetch (unsigned int index)
+static void __init check_prefetch(ide_drive_t *drive, unsigned int index)
 {
-   ide_drive_t *drive = cmd_drives[index];
u8 b = get_cmd640_reg(prefetch_regs[index]);
 
if (b  prefetch_masks[index]) {/* is prefetch off? */
@@ -404,28 +402,13 @@ static void __init check_prefetch (unsig
}
 }
 
-/*
- * Figure out which devices we control
- */
-static void __init setup_device_ptrs (void)
-{
-   cmd_hwif0 = ide_hwifs[0];
-   cmd_hwif1 = ide_hwifs[1];
-
-   cmd_drives[0] = cmd_hwif0-drives[0];
-   cmd_drives[1] = cmd_hwif0-drives[1];
-   cmd_drives[2] = cmd_hwif1-drives[0];
-   cmd_drives[3] = cmd_hwif1-drives[1];
-}
-
 #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
 
 /*
  * Sets prefetch mode for a drive.
  */
-static void set_prefetch_mode (unsigned int index, int mode)
+static void set_prefetch_mode(ide_drive_t *drive, unsigned int index, int mode)
 {
-   ide_drive_t *drive = cmd_drives[index];
unsigned long flags;
int reg = prefetch_regs[index];
u8 b;
@@ -508,7 +491,7 @@ static void __init retrieve_drive_counts
  * This routine writes the prepared setup/active/recovery counts
  * for a drive into the cmd640 chipset registers to active them.
  */
-static void program_drive_counts (unsigned int index)
+static void program_drive_counts(ide_drive_t *drive, unsigned int index)
 {
unsigned long flags;
u8 setup_count= setup_counts[index];
@@ -522,8 +505,11 @@ static void program_drive_counts (unsign
 * so we merge the timings, using the slowest value for each timing.
 */
if (index  1) {
-   unsigned int mate;
-   if (cmd_drives[mate = index ^ 1]-present) {
+   ide_hwif_t *hwif = drive-hwif;
+   ide_drive_t *peer = hwif-drives[!drive-select.b.unit];
+   unsigned int mate = index ^ 1;
+
+   if (peer-present) {
if (setup_count  setup_counts[mate])
setup_count = setup_counts[mate];
if (active_count  active_counts[mate])
@@ -562,7 +548,8 @@ static void program_drive_counts (unsign
 /*
  * Set a specific pio_mode for a drive
  */
-static void cmd640_set_mode (unsigned int index, u8 pio_mode, unsigned int 
cycle_time)
+static void cmd640_set_mode(ide_drive_t *drive, unsigned int index,
+   u8 pio_mode, unsigned int cycle_time)
 {
int setup_time, active_time, recovery_time, clock_time;
u8 setup_count, active_count, recovery_count, recovery_count2, 
cycle_count;
@@ -611,7 +598,7 @@ static void cmd640_set_mode (unsigned in
 *  1) this is the wrong place to do it (proper is do_special() in 
ide.c)
 *  2) in practice this is rarely, if ever, necessary
 */
-   program_drive_counts (index);
+   program_drive_counts(drive, index);
 }
 
 static void cmd640_set_pio_mode(ide_drive_t *drive, const u8 pio)
@@ -619,13 +606,6 @@ static void cmd640_set_pio_mode(ide_driv
unsigned int index = 0, cycle_time;
u8 b;
 
-   while (drive != cmd_drives[index]) {
-   if (++index  3) {
-   printk(KERN_ERR %s: bad news in %s\n,
-   drive-name, __FUNCTION__);
-   return;
-   }
-   }
switch (pio) {
case 6: /* set fast-devsel off */
case 7: /* set fast-devsel on */
@@ -638,13 +618,13 @@ static void cmd640_set_pio_mode(ide_driv
 
case 8: /* set prefetch off */
case 9: /* set prefetch on */
-   set_prefetch_mode(index, pio  1);
+   set_prefetch_mode(drive, index, pio  1);
printk(%s: %sabled cmd640 prefetch\n, drive-name, 
(pio  1) ? en : dis);
return;
}
 
cycle_time

mount: could not find filesystem - aacraid? (was: Re: 2.6.26-git0: IDE oops during boot)

2008-02-14 Thread Bartlomiej Zolnierkiewicz

Hi,

On Thursday 14 February 2008, Kamalesh Babulal wrote:
 Bartlomiej Zolnierkiewicz wrote:
  Hi,
  
  On Tuesday 12 February 2008, Kamalesh Babulal wrote:
  Bartlomiej Zolnierkiewicz wrote:
  Hi,
 
  On Monday 11 February 2008, Kamalesh Babulal wrote:
  Nish Aravamudan wrote:
  On 2/7/08, Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] wrote:
  On Thursday 07 February 2008, Kamalesh Babulal wrote:
  Bartlomiej Zolnierkiewicz wrote:
  Hi,
 
  On Wednesday 06 February 2008, Pavel Machek wrote:
  On Wed 2008-02-06 11:53:34, Pavel Machek wrote:
  Hi!
 
  Trying to boot 2.6.25-git0 (few days old), I get
 
  BUG: unable to handle kernel paging request at ..ffb0
  IP at init_irq+0x42e
  init_irq? hmm...
 
  Call trace:
  ide_device_add_all
  this comes from ide-generic
  (Generic IDE host driver)
 
  ide_generic_init
  kernel_init
  child_rip
  vgacon_cursor
  kernel_init
  child_rip
 
  Excerpt from config:
 
  CONFIG_IDE=y
  CONFIG_BLK_DEV_IDE=y
  Disabling CONFIG_IDE made my machine boot, as it was using libata
  anyway.
  Kamalesh/Pavel:
 
  Could you try latest git and see if the OOPS is still there?
 
  [ Yeah, I'm unable to reproduce it. :( ]
 
  Thanks,
  Bart
  Hi Bart,
 
  The panic is reproducible with the 2.6.24-git16 kernel, the call 
  trace is
  similar to the previous one
  Thanks, I again reviewed ide-probe.c changes but nothing seems wrong...
 
  Could you please bisect it down to the guilty commit?
  Kamalesh, were you able to bisect this down? I just got hit by the
  same panic on a 4-way x86_64, with 2.6.24-git22.
 
  Thanks,
  Nish
  Hi Nish,
 
  I tried bisecting and the guilty patch seems to be 
 
  36501650ec45b1db308c3b51886044863be2d762 is first bad commit
  commit 36501650ec45b1db308c3b51886044863be2d762
  Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
  Date:   Fri Feb 1 23:09:31 2008 +0100
 
  ide: keep pointer to struct device instead of struct pci_dev in 
  ide_hwif_t
 
 
  the gdb output, also points to the changes made by the guilty patch
 
  (gdb) p ide_device_add_all
  $1 = {int (u8 *, const struct ide_port_info *)} 0x804176ac 
  ide_device_add_all
  (gdb) p/x 0x804176ac+0xb60
  $2 = 0x8041820c
  (gdb) l *0x8041820c
  0x8041820c is in ide_device_add_all 
  (drivers/ide/ide-probe.c:1249).
  1244goto out;
  1245}
  1246
  1247sg_init_table(hwif-sg_table, hwif-sg_max_nents);
  1248
  1249if (init_irq(hwif) == 0)
  1250goto done;
  1251
  1252old_irq = hwif-irq;
  1253/*
  (gdb) 
 
 
  (gdb) p init_irq
  $1 = {int (ide_hwif_t *)} 0x8041721f init_irq
  (gdb) p/x 0x8041721f+0x1a4
  $2 = 0x804173c3
  (gdb) l *0x804173c3
  0x804173c3 is in init_irq (include/asm/pci.h:101).
  96  /* Returns the node based on pci bus */
  97  static inline int __pcibus_to_node(struct pci_bus *bus)
  98  {
  99  struct pci_sysdata *sd = bus-sysdata;
  100
  101 return sd-node;
  102 }
  103
  104 static inline cpumask_t __pcibus_to_cpumask(struct pci_bus *bus)
  105 {
  (gdb) 
  Thanks for the detailed analysis and sorry for the bug.
 
  I think that this may has been just fixed by Andi's recent hwif_to_node()
  fix (patch below, it is in Linus' tree already), could please verify this?
 
  commit 1f07e988290fc45932f5028c9e2a862c37a57336
  Author: Andi Kleen [EMAIL PROTECTED]
  Date:   Mon Feb 11 01:35:20 2008 +0100
 
  Prevent IDE boot ops on NUMA system
  
  Without this patch a Opteron test system here oopses at boot with
  current git.
  
  Calling to_pci_dev() on a NULL pointer gives a negative value so the
  following NULL pointer check never triggers and then an illegal 
  address
  is referenced.  Check the unadjusted original device pointer for NULL
  instead.
  
  Signed-off-by: Andi Kleen [EMAIL PROTECTED]
  Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
 
  diff --git a/include/linux/ide.h b/include/linux/ide.h
  index 23fad89..a3b69c1 100644
  --- a/include/linux/ide.h
  +++ b/include/linux/ide.h
  @@ -1295,7 +1295,7 @@ static inline void ide_dump_identify(u8 *id)
   static inline int hwif_to_node(ide_hwif_t *hwif)
   {
struct pci_dev *dev = to_pci_dev(hwif-dev);
  - return dev ? pcibus_to_node(dev-bus) : -1;
  + return hwif-dev ? pcibus_to_node(dev-bus) : -1;
   }
 
   static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive)
  Hi Bart,
  Thanks !! the patch solves the kernel panic but when after applying the 
  patch,kernel is not
  able to mount the filesystem and panics, am i not sure what is likely 
  causing the panic.
  
  Is
  
  - the commit 36501650ec45b1db308c3b51886044863be2d762 with Andi's fix 
  applied
  
  or
  
  - the commit f6fb786d6dcdd7d730e4fba620b071796f487e1b
(the one before commit 36501650ec45b1db308c3b51886044863be2d762)
  
  working for you?
 
 No, the commit

Re: mount: could not find filesystem - aacraid? (was: Re: 2.6.26-git0: IDE oops during boot)

2008-02-14 Thread Bartlomiej Zolnierkiewicz
On Thursday 14 February 2008, Bartlomiej Zolnierkiewicz wrote:
 
 Hi,
 
 On Thursday 14 February 2008, Kamalesh Babulal wrote:
  Bartlomiej Zolnierkiewicz wrote:
   Hi,
   
   On Tuesday 12 February 2008, Kamalesh Babulal wrote:
   Bartlomiej Zolnierkiewicz wrote:
   Hi,
  
   On Monday 11 February 2008, Kamalesh Babulal wrote:
   Nish Aravamudan wrote:
   On 2/7/08, Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] wrote:
   On Thursday 07 February 2008, Kamalesh Babulal wrote:
   Bartlomiej Zolnierkiewicz wrote:
   Hi,
  
   On Wednesday 06 February 2008, Pavel Machek wrote:
   On Wed 2008-02-06 11:53:34, Pavel Machek wrote:
   Hi!
  
   Trying to boot 2.6.25-git0 (few days old), I get
  
   BUG: unable to handle kernel paging request at ..ffb0
   IP at init_irq+0x42e
   init_irq? hmm...
  
   Call trace:
   ide_device_add_all
   this comes from ide-generic
   (Generic IDE host driver)
  
   ide_generic_init
   kernel_init
   child_rip
   vgacon_cursor
   kernel_init
   child_rip
  
   Excerpt from config:
  
   CONFIG_IDE=y
   CONFIG_BLK_DEV_IDE=y
   Disabling CONFIG_IDE made my machine boot, as it was using libata
   anyway.
   Kamalesh/Pavel:
  
   Could you try latest git and see if the OOPS is still there?
  
   [ Yeah, I'm unable to reproduce it. :( ]
  
   Thanks,
   Bart
   Hi Bart,
  
   The panic is reproducible with the 2.6.24-git16 kernel, the call 
   trace is
   similar to the previous one
   Thanks, I again reviewed ide-probe.c changes but nothing seems 
   wrong...
  
   Could you please bisect it down to the guilty commit?
   Kamalesh, were you able to bisect this down? I just got hit by the
   same panic on a 4-way x86_64, with 2.6.24-git22.
  
   Thanks,
   Nish
   Hi Nish,
  
   I tried bisecting and the guilty patch seems to be 
  
   36501650ec45b1db308c3b51886044863be2d762 is first bad commit
   commit 36501650ec45b1db308c3b51886044863be2d762
   Author: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
   Date:   Fri Feb 1 23:09:31 2008 +0100
  
   ide: keep pointer to struct device instead of struct pci_dev in 
   ide_hwif_t
  
  
   the gdb output, also points to the changes made by the guilty patch
  
   (gdb) p ide_device_add_all
   $1 = {int (u8 *, const struct ide_port_info *)} 0x804176ac 
   ide_device_add_all
   (gdb) p/x 0x804176ac+0xb60
   $2 = 0x8041820c
   (gdb) l *0x8041820c
   0x8041820c is in ide_device_add_all 
   (drivers/ide/ide-probe.c:1249).
   1244goto out;
   1245}
   1246
   1247sg_init_table(hwif-sg_table, hwif-sg_max_nents);
   1248
   1249if (init_irq(hwif) == 0)
   1250goto done;
   1251
   1252old_irq = hwif-irq;
   1253/*
   (gdb) 
  
  
   (gdb) p init_irq
   $1 = {int (ide_hwif_t *)} 0x8041721f init_irq
   (gdb) p/x 0x8041721f+0x1a4
   $2 = 0x804173c3
   (gdb) l *0x804173c3
   0x804173c3 is in init_irq (include/asm/pci.h:101).
   96  /* Returns the node based on pci bus */
   97  static inline int __pcibus_to_node(struct pci_bus *bus)
   98  {
   99  struct pci_sysdata *sd = bus-sysdata;
   100
   101 return sd-node;
   102 }
   103
   104 static inline cpumask_t __pcibus_to_cpumask(struct pci_bus 
   *bus)
   105 {
   (gdb) 
   Thanks for the detailed analysis and sorry for the bug.
  
   I think that this may has been just fixed by Andi's recent 
   hwif_to_node()
   fix (patch below, it is in Linus' tree already), could please verify 
   this?
  
   commit 1f07e988290fc45932f5028c9e2a862c37a57336
   Author: Andi Kleen [EMAIL PROTECTED]
   Date:   Mon Feb 11 01:35:20 2008 +0100
  
   Prevent IDE boot ops on NUMA system
   
   Without this patch a Opteron test system here oopses at boot with
   current git.
   
   Calling to_pci_dev() on a NULL pointer gives a negative value so the
   following NULL pointer check never triggers and then an illegal 
   address
   is referenced.  Check the unadjusted original device pointer for 
   NULL
   instead.
   
   Signed-off-by: Andi Kleen [EMAIL PROTECTED]
   Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
  
   diff --git a/include/linux/ide.h b/include/linux/ide.h
   index 23fad89..a3b69c1 100644
   --- a/include/linux/ide.h
   +++ b/include/linux/ide.h
   @@ -1295,7 +1295,7 @@ static inline void ide_dump_identify(u8 *id)
static inline int hwif_to_node(ide_hwif_t *hwif)
{
   struct pci_dev *dev = to_pci_dev(hwif-dev);
   -   return dev ? pcibus_to_node(dev-bus) : -1;
   +   return hwif-dev ? pcibus_to_node(dev-bus) : -1;
}
  
static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive)
   Hi Bart,
   Thanks !! the patch solves the kernel panic but when after applying the 
   patch,kernel is not
   able to mount the filesystem and panics, am i not sure what is likely 
   causing the panic

Re: IDE cdrom problem with PLEXTOR DVDR PX-608AL

2008-02-14 Thread Bartlomiej Zolnierkiewicz
On Thursday 14 February 2008, Borislav Petkov wrote:
 On Thu, Feb 14, 2008 at 12:37:50AM +0100, Hans-Peter Jansen wrote:
 
 [Added Bart to CC]
 
  Am Dienstag, 12. Februar 2008 schrieb Borislav Petkov:
   On Tue, Feb 12, 2008 at 10:26:17AM +0100, Hans-Peter Jansen wrote:
Hi,
   
I suffer from unreliable cdrom operations (failing DAE and burn
sessions) with the openSUSE 2.6.18.8-0.7-bigsmp kernel.
  
 
   Hi,
  
   can please you test this with a more recent kernel. Yours is almost
   ancient - from Sep. 2006.
  
  Sure, sorry. Here we go:
  
  Feb 14 00:18:18 kernel: hde: cdrom_pc_intr: The drive appears confused 
  (ireason = 0x01).
   Trying to recover by ending request.
  Feb 14 00:27:27 kernel: hdc: cdrom_pc_intr: The drive appears confused 
  (ireason = 0x01). 
   Trying to recover by ending request.
  
  ~ uname -a
  Linux xrated 2.6.24.1-35-pae #1 SMP 2008/02/12 01:00:18 UTC i686 athlon 
  i386 GNU/Linux
 
 Actually the interrupt handler in ide-cd got rewritten and you're still using 
 the
 old one (cdrom_pc_intr vs cdrom_newpc_intr). Those changes went into mainline 
 before
 the 2.6.25-rc1 so we'll be able to test the new one only when you try out 
 2.6.25-rc1
 or wait until 2.6.25 is released in case you don't want to try hazardous 
 materials
 such as an -rc kernel[*] :).
 
 Bart?
 
 *. As a matter of fact it runs quite smoothly on my machines.

2.6.25-rc1-git1 if you are using IDE.

however it may still have this problem

if (ireason == 0) {
write = 1;
xferfunc = HWIF(drive)-atapi_output_bytes;
} else if (ireason == 2 || (ireason == 1 
   (blk_fs_request(rq) || blk_pc_request(rq {

we problably need to call ide_cd_check_ireason() also for REQ_TYPE_ATA_PC
requests and remove (blk_fs_request(rq) || blk_pc_request(rq) here

write = 0;
xferfunc = HWIF(drive)-atapi_input_bytes;
} else {
printk(KERN_ERR %s: %s: The drive 
appears confused (ireason = 0x%02x). 
Trying to recover by ending request.\n,
drive-name, __FUNCTION__, ireason);
goto end_request;
}

Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [discuss] pci_get_device_reverse(), why does Calgary need this?

2008-02-14 Thread Bartlomiej Zolnierkiewicz
On Thursday 14 February 2008, Andreas Jaeger wrote:
 Greg KH [EMAIL PROTECTED] writes:
 
  How does the patch below look?  I didn't want to remove the whole config
  option, as there is more to the logic than just the reverse order
  stuff there.
 
 I think you miss Documentation - it's mentioned in ide.txt and
 kernel-parameters.txt,

+ drivers/ide/Kconfig

Greg, please update the patch (and add my S-o-B while at it).

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ide-floppy: merge callbacks

2008-02-14 Thread Bartlomiej Zolnierkiewicz
On Thursday 14 February 2008, Borislav Petkov wrote:
 On Wed, Feb 13, 2008 at 11:04:23PM +0100, Bartlomiej Zolnierkiewicz wrote:
  On Wednesday 13 February 2008, Borislav Petkov wrote:
   commit d1f1f84f413ab00cb2fec48170d022fcd900e214
   Author: Borislav Petkov [EMAIL PROTECTED]
   Date:   Wed Feb 13 20:26:56 2008 +0100
   
   ide-floppy: merge callbacks
   
   The appropriate functionality of the callback is established through 
   querying
   the ATAPI packet command in pc-c[0].
   
   While at it, simplify if (floppy-failed_pc)-branch to be found in 
   the original
   idefloppy_request_sense_callback().
   
   Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
   
   diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
   index 5f133df..1365310 100644
   --- a/drivers/ide/ide-floppy.c
   +++ b/drivers/ide/ide-floppy.c
   @@ -313,50 +313,39 @@ static struct request 
   *idefloppy_next_rq_storage(ide_drive_t *drive)
 return (floppy-rq_stack[floppy-rq_stack_index++]);
}

   -static void idefloppy_request_sense_callback(ide_drive_t *drive)
   +static void ide_floppy_callback(ide_drive_t *drive)
{
 idefloppy_floppy_t *floppy = drive-driver_data;
   - u8 *buf = floppy-pc-buf;

 debug_log(Reached %s\n, __func__);

   - if (!floppy-pc-error) {
   - floppy-sense_key = buf[2]  0x0F;
   - floppy-asc = buf[12];
   - floppy-ascq = buf[13];
   - floppy-progress_indication = buf[15]  0x80 ?
   - (u16)get_unaligned((u16 *)buf[16]) : 0x1;
   + if (floppy-pc-c[0] == GPCMD_REQUEST_SENSE) {
   + u8 *buf = floppy-pc-buf;

   - if (floppy-failed_pc)
   - debug_log(pc = %x, sense key = %x, asc = %x,
   -  ascq = %x\n,
   - floppy-failed_pc-c[0],
   - floppy-sense_key,
   - floppy-asc,
   - floppy-ascq);
   - else
   - debug_log(sense key = %x, asc = %x, ascq = %x\n,
   - floppy-sense_key,
   - floppy-asc,
   - floppy-ascq);
   -
   -
   - idefloppy_end_request(drive, 1, 0);
   - } else {
   - printk(KERN_ERR Error in REQUEST SENSE itself - Aborting
   -  request!\n);
   - idefloppy_end_request(drive, 0, 0);
   - }
   -}
   + if (!floppy-pc-error) {
   + floppy-sense_key = buf[2]  0x0F;
   + floppy-asc = buf[12];
   + floppy-ascq = buf[13];
   + floppy-progress_indication = buf[15]  0x80 ?
   + (u16)get_unaligned((u16 *)buf[16]) : 0x1;

   -/* General packet command callback function. */
   -static void idefloppy_pc_callback(ide_drive_t *drive)
   -{
   - idefloppy_floppy_t *floppy = drive-driver_data;
   + if (floppy-failed_pc)
   + debug_log(pc = %x, , floppy-failed_pc-c[0]);

   - debug_log(Reached %s\n, __func__);
   + debug_log(sense key = %x, asc = %x, ascq = %x\n,
   + floppy-sense_key, floppy-asc, floppy-ascq);

   - idefloppy_end_request(drive, floppy-pc-error ? 0 : 1, 0);
   + idefloppy_end_request(drive, 1, 0);
   + } else {
   + printk(KERN_ERR Error in REQUEST SENSE itself - 
   + Aborting request!\n);
   + idefloppy_end_request(drive, 0, 0);
   + }
   + } else if (floppy-pc-c[0] == GPCMD_READ_10 ||
   + floppy-pc-c[0] == GPCMD_WRITE_10)
   + idefloppy_end_request(drive, 1, 0);
   + else
   + idefloppy_end_request(drive, floppy-pc-error ? 0 : 1, 0);
}

static void idefloppy_init_pc(struct ide_atapi_pc *pc)
   @@ -367,7 +356,7 @@ static void idefloppy_init_pc(struct ide_atapi_pc *pc)
 pc-req_xfer = 0;
 pc-buf = pc-pc_buf;
 pc-buf_size = IDEFLOPPY_PC_BUFFER_SIZE;
   - pc-idefloppy_callback = idefloppy_pc_callback;
   + pc-idefloppy_callback = ide_floppy_callback;
}

static void idefloppy_create_request_sense_cmd(struct ide_atapi_pc *pc)
   @@ -376,7 +365,6 @@ static void idefloppy_create_request_sense_cmd(struct 
   ide_atapi_pc *pc)
 pc-c[0] = GPCMD_REQUEST_SENSE;
 pc-c[4] = 255;
 pc-req_xfer = 18;
   - pc-idefloppy_callback = idefloppy_request_sense_callback;
}

/*
   @@ -697,14 +685,6 @@ static ide_startstop_t 
   idefloppy_issue_pc(ide_drive_t *drive,
 }
}

   -static void idefloppy_rw_callback(ide_drive_t *drive)
   -{
   - debug_log(Reached %s\n, __func__);
   -
   - idefloppy_end_request(drive, 1, 0);
   - return;
   -}
   -
static void idefloppy_create_prevent_cmd(struct ide_atapi_pc *pc, int 
   prevent)
{
 debug_log(creating

[PATCH 2/2] ide: remove CONFIG_IDE_ARCH_OBSOLETE_INIT

2008-02-14 Thread Bartlomiej Zolnierkiewicz
* Use CONFIG_IDE_ARCH_OBSOLETE_DEFAULTS instead of
  CONFIG_IDE_ARCH_OBSOLETE_INIT in init_ide_data().

* Remove no longer needed CONFIG_IDE_ARCH_OBSOLETE_INIT.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/Kconfig |3 ---
 drivers/ide/ide.c   |4 ++--
 2 files changed, 2 insertions(+), 5 deletions(-)

Index: b/drivers/ide/Kconfig
===
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -1096,9 +1096,6 @@ config BLK_DEV_IDEDMA
def_bool BLK_DEV_IDEDMA_SFF || BLK_DEV_IDEDMA_PMAC || \
 BLK_DEV_IDEDMA_ICS || BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
 
-config IDE_ARCH_OBSOLETE_INIT
-   def_bool ALPHA || (ARM  !ARCH_L7200) || BLACKFIN || X86 || IA64 || 
M32R || MIPS || PARISC || PPC || (SUPERH64  BLK_DEV_IDEPCI) || SPARC
-
 config IDE_ARCH_OBSOLETE_DEFAULTS
def_bool ALPHA || X86 || IA64 || M32R || MIPS || PPC32
 
Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -209,16 +209,16 @@ static void __init init_ide_data (void)
 
ide_init_port_data(hwif, index);
 
-#ifdef CONFIG_IDE_ARCH_OBSOLETE_INIT
+#ifdef CONFIG_IDE_ARCH_OBSOLETE_DEFAULTS
memset(hw, 0, sizeof(hw));
ide_std_init_ports(hw, io_addr, ctl_addr);
memcpy(hwif-io_ports, hw.io_ports, sizeof(hw.io_ports));
-#endif
hwif-noprobe = !hwif-io_ports[IDE_DATA_OFFSET];
 #if !defined(CONFIG_PPC32) || defined(CONFIG_PPLUS) || !defined(CONFIG_PCI)
hwif-irq =
ide_init_default_irq(hwif-io_ports[IDE_DATA_OFFSET]);
 #endif
+#endif
}
 }
 
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] ide: add CONFIG_IDE_ARCH_OBSOLETE_DEFAULTS

2008-02-14 Thread Bartlomiej Zolnierkiewicz
Add CONFIG_IDE_ARCH_OBSOLETE_DEFAULTS to drivers/ide/Kconfig and use
it instead of defining IDE_ARCH_OBSOLETE_DEFAULTS in arch/ide.h.

Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
---
 drivers/ide/Kconfig |3 +++
 drivers/ide/ide.c   |5 +
 include/asm-alpha/ide.h |3 ---
 include/asm-ia64/ide.h  |2 --
 include/asm-m32r/ide.h  |2 --
 include/asm-mips/mach-generic/ide.h |2 --
 include/asm-powerpc/ide.h   |2 --
 include/asm-x86/ide.h   |2 --
 include/linux/ide.h |7 ---
 9 files changed, 8 insertions(+), 20 deletions(-)

Index: b/drivers/ide/Kconfig
===
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -1099,6 +1099,9 @@ config BLK_DEV_IDEDMA
 config IDE_ARCH_OBSOLETE_INIT
def_bool ALPHA || (ARM  !ARCH_L7200) || BLACKFIN || X86 || IA64 || 
M32R || MIPS || PARISC || PPC || (SUPERH64  BLK_DEV_IDEPCI) || SPARC
 
+config IDE_ARCH_OBSOLETE_DEFAULTS
+   def_bool ALPHA || X86 || IA64 || M32R || MIPS || PPC32
+
 endif
 
 config BLK_DEV_HD_ONLY
Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -167,6 +167,11 @@ static void ide_port_init_devices_data(i
}
 }
 
+#ifndef CONFIG_IDE_ARCH_OBSOLETE_DEFAULTS
+# define ide_default_io_base(index)(0)
+# define ide_default_irq(base) (0)
+# define ide_init_default_irq(base)(0)
+#endif
 
 /*
  * init_ide_data() sets reasonable default values into all fields
Index: b/include/asm-alpha/ide.h
===
--- a/include/asm-alpha/ide.h
+++ b/include/asm-alpha/ide.h
@@ -13,9 +13,6 @@
 
 #ifdef __KERNEL__
 
-
-#define IDE_ARCH_OBSOLETE_DEFAULTS
-
 static inline int ide_default_irq(unsigned long base)
 {
switch (base) {
Index: b/include/asm-ia64/ide.h
===
--- a/include/asm-ia64/ide.h
+++ b/include/asm-ia64/ide.h
@@ -16,8 +16,6 @@
 
 #include linux/irq.h
 
-#define IDE_ARCH_OBSOLETE_DEFAULTS
-
 static inline int ide_default_irq(unsigned long base)
 {
switch (base) {
Index: b/include/asm-m32r/ide.h
===
--- a/include/asm-m32r/ide.h
+++ b/include/asm-m32r/ide.h
@@ -23,8 +23,6 @@
 # endif
 #endif
 
-#define IDE_ARCH_OBSOLETE_DEFAULTS
-
 static __inline__ int ide_default_irq(unsigned long base)
 {
switch (base) {
Index: b/include/asm-mips/mach-generic/ide.h
===
--- a/include/asm-mips/mach-generic/ide.h
+++ b/include/asm-mips/mach-generic/ide.h
@@ -27,8 +27,6 @@
 # endif
 #endif
 
-#define IDE_ARCH_OBSOLETE_DEFAULTS
-
 static __inline__ int ide_probe_legacy(void)
 {
 #ifdef CONFIG_PCI
Index: b/include/asm-powerpc/ide.h
===
--- a/include/asm-powerpc/ide.h
+++ b/include/asm-powerpc/ide.h
@@ -31,8 +31,6 @@
 #include linux/hdreg.h
 #include linux/ioport.h
 
-#define IDE_ARCH_OBSOLETE_DEFAULTS
-
 /* FIXME: use ide_platform host driver */
 static __inline__ int ide_default_irq(unsigned long base)
 {
Index: b/include/asm-x86/ide.h
===
--- a/include/asm-x86/ide.h
+++ b/include/asm-x86/ide.h
@@ -20,8 +20,6 @@
 # endif
 #endif
 
-#define IDE_ARCH_OBSOLETE_DEFAULTS
-
 static __inline__ int ide_default_irq(unsigned long base)
 {
switch (base) {
Index: b/include/linux/ide.h
===
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -194,13 +194,6 @@ static inline void ide_std_init_ports(hw
 #define MAX_HWIFS  CONFIG_IDE_MAX_HWIFS
 #endif
 
-/* needed on alpha, x86/x86_64, ia64, mips, ppc32 and sh */
-#ifndef IDE_ARCH_OBSOLETE_DEFAULTS
-# define ide_default_io_base(index)(0)
-# define ide_default_irq(base) (0)
-# define ide_init_default_irq(base)(0)
-#endif
-
 /* Currently only m68k, apus and m8xx need it */
 #ifndef IDE_ARCH_ACK_INTR
 # define ide_ack_intr(hwif) (1)
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] ide: add CONFIG_IDE_ARCH_OBSOLETE_DEFAULTS

2008-02-14 Thread Bartlomiej Zolnierkiewicz

Hi,

On Thursday 14 February 2008, Sam Ravnborg wrote:
 Hi Bart.
 
 On Thu, Feb 14, 2008 at 09:55:50PM +0100, Bartlomiej Zolnierkiewicz wrote:
  Add CONFIG_IDE_ARCH_OBSOLETE_DEFAULTS to drivers/ide/Kconfig and use
  it instead of defining IDE_ARCH_OBSOLETE_DEFAULTS in arch/ide.h.
  
  Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
  ---
   drivers/ide/Kconfig |3 +++
   drivers/ide/ide.c   |5 +
   include/asm-alpha/ide.h |3 ---
   include/asm-ia64/ide.h  |2 --
   include/asm-m32r/ide.h  |2 --
   include/asm-mips/mach-generic/ide.h |2 --
   include/asm-powerpc/ide.h   |2 --
   include/asm-x86/ide.h   |2 --
   include/linux/ide.h |7 ---
   9 files changed, 8 insertions(+), 20 deletions(-)
  
  Index: b/drivers/ide/Kconfig
  ===
  --- a/drivers/ide/Kconfig
  +++ b/drivers/ide/Kconfig
  @@ -1099,6 +1099,9 @@ config BLK_DEV_IDEDMA
   config IDE_ARCH_OBSOLETE_INIT
  def_bool ALPHA || (ARM  !ARCH_L7200) || BLACKFIN || X86 || IA64 || 
  M32R || MIPS || PARISC || PPC || (SUPERH64  BLK_DEV_IDEPCI) || SPARC
   
  +config IDE_ARCH_OBSOLETE_DEFAULTS
  +   def_bool ALPHA || X86 || IA64 || M32R || MIPS || PPC32
  +
   endif
 
 
 This time it is maybe borderline as it makes sense to see a list of
 archs that uses this.
 But still I would prefer you did like this:
 
 drivers/ide/Kconfig:
 
 config HAVE_IDE_ARCH_OBSOLETE_DEFAULTS
   bool
 
 config IDE_ARCH_OBSOLETE_DEFAULTS
   depends on HAVE_IDE_ARCH_OBSOLETE_DEFAULTS
 
 And then in each arch Kconfig include:
 
 arch/alpha/Kconfig:
 config ALPHA
   select HAVE_ARCH_OBSOLETE_DEFAULTS
 
 And the same for the others.

I agree but this option is meant to be only temporary to ease the cleanup
process.  We can think about the proper solution after default IDE ports
initialization gets moved to ide_generic host driver.

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 09/18] ide: rework PowerMac media-bay support

2008-02-13 Thread Bartlomiej Zolnierkiewicz

Hi,

On Wednesday 13 February 2008, Michael Ellerman wrote:
 On Fri, 2008-02-08 at 01:45 +0100, Bartlomiej Zolnierkiewicz wrote:
  Rework PowerMac media-bay support in such way that instead of
  un/registering the IDE interface we un/register IDE devices:
  
  * Add ide_port_scan() helper for probing+registerering devices on a port.
  
  * Rename ide_port_unregister_devices() to __ide_port_unregister_devices().
  
  * Add ide_port_unregister_devices() helper for unregistering devices on a 
  port.
  
  * Add 'ide_hwif_t *cd_port' to 'struct media_bay_info', pass 'hwif' instead
of hwif-index to media_bay_set_ide_infos() and use it to setup 'cd_port'.
  
  * Use ide_port_unregister_devices() instead of ide_unregister()
and ide_port_scan() instead of ide_register_hw() in media_bay_step().
  
  * Unexport ide_register_hw() and make it static.
  
  Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED]
  ---
   drivers/ide/ide-probe.c|   18 ++
   drivers/ide/ide.c  |   22 --
   drivers/ide/ppc/pmac.c |3 ++-
   drivers/macintosh/mediabay.c   |   17 +++--
   include/asm-powerpc/mediabay.h |4 +++-
   include/linux/ide.h|6 ++
   6 files changed, 48 insertions(+), 22 deletions(-)
 
  Index: b/include/asm-powerpc/mediabay.h
  ===
  --- a/include/asm-powerpc/mediabay.h
  +++ b/include/asm-powerpc/mediabay.h
  @@ -22,10 +22,12 @@ int check_media_bay(struct device_node *
   /* Number of bays in the machine or 0 */
   extern int media_bay_count;
   
  +#ifdef CONFIG_BLK_DEV_IDE_PMAC

Does adding:

#include linux/ide.h

after ifdef help?

   int check_media_bay_by_base(unsigned long base, int what);
   /* called by IDE PMAC host driver to register IDE controller for media bay 
  */
   int media_bay_set_ide_infos(struct device_node *which_bay, unsigned long 
  base,
  -   int irq, int index);
  +   int irq, ide_hwif_t *hwif);
  +#endif
   
   #endif /* __KERNEL__ */
   #endif /* _PPC_MEDIABAY_H */
 
 This hunk breaks pmac32_defconfig for me.
 
 include2/asm/mediabay.h:29: error: syntax error before 'ide_hwif_t'
 make[3]: *** [arch/powerpc/platforms/powermac/setup.o] Error 1
 make[2]: *** [arch/powerpc/platforms/powermac] Error 2
 make[1]: *** [arch/powerpc/platforms] Error 2
 make: *** [sub-make] Error 2
 
 cheers
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: pci_get_device_reverse(), why does Calgary need this?

2008-02-13 Thread Bartlomiej Zolnierkiewicz
On Wednesday 13 February 2008, Greg KH wrote:
 On Wed, Feb 13, 2008 at 02:17:37AM +, Alan Cox wrote:
   Why does the calgary driver need this?  Can we just use pci_get_device()
   instead?  Why do you need to walk the device list backwards?  Do you get
   false positives going forward?
  
  It doesn't look to be performance critical so the driver can
  pci_get_device until the end and use the final hit anyway.
 
 That would make more sense.
 
  IDE reverse is more problematic but nobody seems to use it.
 
 I've seen two posters say they use it.  I'm wondering what it is really
 solving if they use it, and why if it's really needed, scsi never had to
 implement such a hack...

It is no longer solving anything, just adds more pain. ;)

[ The option comes from 2.2.x (so long before LABEL=/ and /dev/disk/by-id/
  became popular).  Some off-board controllers integrated on motherboards
  used to appear before on-board IDE on PCI bus so this option was meant
  to preserve the legacy ordering. ]

Since it is valid only when Probe IDE PCI devices in the PCI bus order
(DEPRECATED) config option is used it is already on its way out (though
marking it as obsoleted would make it more explicit).

I think that removing ide=reverse in 2.6.26 would be OK...

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH] ide-floppy: use rq-cmd for preparing and sending packet cmds to the drive

2008-02-13 Thread Bartlomiej Zolnierkiewicz

Hi,

On Wednesday 13 February 2008, Borislav Petkov wrote:
 On Tue, Feb 12, 2008 at 10:39:22PM +0100, Bartlomiej Zolnierkiewicz wrote:
 
 Hi Bart,
 
  I think that this _really_ should be done _after_ unifying ATAPI handling 
  [*].
  Otherwise you will be making some of the same changes to the _three_ copies
  of (more or less) identical code and more importantly we will have to delay
  unification after _all_ drivers are converted to rq-cmd[] (+ lets not 
  forget
  that I'll have more changes to review ;).
  
  (*) please take a closer look at *_issue_pc(), *_transfer_pc() and 
  *_pc_intr()
  in ide-{floppy,tape,scsi} (the useful hint is that after making these
  functions free of references to device driver specific objects/functions
  we can use drive-media == ide_{floppy,tape,scsi} checks for handling
  not yet fully unified / media type specific code).
 
 I started working on probably the easiest unification we could do: unify all 
 the
 pc-flags defines and move them in a header where all drivers can use them. 
 This

Yep.

 raises an architectural design question: The way i see it, the generic ATAPI 
 handling
 is going to be sort of serving functionality to the drivers using ATAPI. Do 
 we want
 all this functionality to go to ide.{h,c} or we want specific atapi.{h,c} 
 files that
 contain only this unified functionality, or whatever else. In general, how is 
 this
 generic layer going to be distributed among headers/.c files and what do we 
 want there?
 
 /me tends to think that special headers/files, small and easy to manage and
 modular, have more advantages in this case but this is just me. After we've
 decided on that, the rest of the issues will resolve by themselves/get easier 
 to
 tackle.

I think that:

drivers/ide/ide-atapi.c
include/linux/ide.h

should be fine for now...

Moving code around is trivial so we can always fixup before pushing upstream.

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] ide: use generic ATAPI packet command flags in ide-{floppy,tape,scsi}

2008-02-13 Thread Bartlomiej Zolnierkiewicz
On Feb 13, 2008 5:18 PM, Borislav Petkov [EMAIL PROTECTED] wrote:
 This is done in one single patch in order not to cause git breakage.

 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]

Looks good but could you please reorder patches and move PC_* - PC_FLAG *
rename in ide-scsi to the patch removing atomic bitops from ide-scsi?

Thanks,
Bart
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] ide: use generic ATAPI packet command flags in ide-{floppy,tape}

2008-02-13 Thread Bartlomiej Zolnierkiewicz
On Wednesday 13 February 2008, Borislav Petkov wrote:
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]

applied
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] ide-scsi: do non-atomic pc-flags testing

2008-02-13 Thread Bartlomiej Zolnierkiewicz
On Wednesday 13 February 2008, Borislav Petkov wrote:
 ...also, convert ide-scsi to using the generic pc-flags defines.
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]

applied
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ide-floppy: merge callbacks

2008-02-13 Thread Bartlomiej Zolnierkiewicz
On Wednesday 13 February 2008, Borislav Petkov wrote:
 commit d1f1f84f413ab00cb2fec48170d022fcd900e214
 Author: Borislav Petkov [EMAIL PROTECTED]
 Date:   Wed Feb 13 20:26:56 2008 +0100
 
 ide-floppy: merge callbacks
 
 The appropriate functionality of the callback is established through 
 querying
 the ATAPI packet command in pc-c[0].
 
 While at it, simplify if (floppy-failed_pc)-branch to be found in the 
 original
 idefloppy_request_sense_callback().
 
 Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
 
 diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
 index 5f133df..1365310 100644
 --- a/drivers/ide/ide-floppy.c
 +++ b/drivers/ide/ide-floppy.c
 @@ -313,50 +313,39 @@ static struct request 
 *idefloppy_next_rq_storage(ide_drive_t *drive)
   return (floppy-rq_stack[floppy-rq_stack_index++]);
  }
  
 -static void idefloppy_request_sense_callback(ide_drive_t *drive)
 +static void ide_floppy_callback(ide_drive_t *drive)
  {
   idefloppy_floppy_t *floppy = drive-driver_data;
 - u8 *buf = floppy-pc-buf;
  
   debug_log(Reached %s\n, __func__);
  
 - if (!floppy-pc-error) {
 - floppy-sense_key = buf[2]  0x0F;
 - floppy-asc = buf[12];
 - floppy-ascq = buf[13];
 - floppy-progress_indication = buf[15]  0x80 ?
 - (u16)get_unaligned((u16 *)buf[16]) : 0x1;
 + if (floppy-pc-c[0] == GPCMD_REQUEST_SENSE) {
 + u8 *buf = floppy-pc-buf;
  
 - if (floppy-failed_pc)
 - debug_log(pc = %x, sense key = %x, asc = %x,
 -  ascq = %x\n,
 - floppy-failed_pc-c[0],
 - floppy-sense_key,
 - floppy-asc,
 - floppy-ascq);
 - else
 - debug_log(sense key = %x, asc = %x, ascq = %x\n,
 - floppy-sense_key,
 - floppy-asc,
 - floppy-ascq);
 -
 -
 - idefloppy_end_request(drive, 1, 0);
 - } else {
 - printk(KERN_ERR Error in REQUEST SENSE itself - Aborting
 -  request!\n);
 - idefloppy_end_request(drive, 0, 0);
 - }
 -}
 + if (!floppy-pc-error) {
 + floppy-sense_key = buf[2]  0x0F;
 + floppy-asc = buf[12];
 + floppy-ascq = buf[13];
 + floppy-progress_indication = buf[15]  0x80 ?
 + (u16)get_unaligned((u16 *)buf[16]) : 0x1;
  
 -/* General packet command callback function. */
 -static void idefloppy_pc_callback(ide_drive_t *drive)
 -{
 - idefloppy_floppy_t *floppy = drive-driver_data;
 + if (floppy-failed_pc)
 + debug_log(pc = %x, , floppy-failed_pc-c[0]);
  
 - debug_log(Reached %s\n, __func__);
 + debug_log(sense key = %x, asc = %x, ascq = %x\n,
 + floppy-sense_key, floppy-asc, floppy-ascq);
  
 - idefloppy_end_request(drive, floppy-pc-error ? 0 : 1, 0);
 + idefloppy_end_request(drive, 1, 0);
 + } else {
 + printk(KERN_ERR Error in REQUEST SENSE itself - 
 + Aborting request!\n);
 + idefloppy_end_request(drive, 0, 0);
 + }
 + } else if (floppy-pc-c[0] == GPCMD_READ_10 ||
 + floppy-pc-c[0] == GPCMD_WRITE_10)
 + idefloppy_end_request(drive, 1, 0);
 + else
 + idefloppy_end_request(drive, floppy-pc-error ? 0 : 1, 0);
  }
  
  static void idefloppy_init_pc(struct ide_atapi_pc *pc)
 @@ -367,7 +356,7 @@ static void idefloppy_init_pc(struct ide_atapi_pc *pc)
   pc-req_xfer = 0;
   pc-buf = pc-pc_buf;
   pc-buf_size = IDEFLOPPY_PC_BUFFER_SIZE;
 - pc-idefloppy_callback = idefloppy_pc_callback;
 + pc-idefloppy_callback = ide_floppy_callback;
  }
  
  static void idefloppy_create_request_sense_cmd(struct ide_atapi_pc *pc)
 @@ -376,7 +365,6 @@ static void idefloppy_create_request_sense_cmd(struct 
 ide_atapi_pc *pc)
   pc-c[0] = GPCMD_REQUEST_SENSE;
   pc-c[4] = 255;
   pc-req_xfer = 18;
 - pc-idefloppy_callback = idefloppy_request_sense_callback;
  }
  
  /*
 @@ -697,14 +685,6 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t 
 *drive,
   }
  }
  
 -static void idefloppy_rw_callback(ide_drive_t *drive)
 -{
 - debug_log(Reached %s\n, __func__);
 -
 - idefloppy_end_request(drive, 1, 0);
 - return;
 -}
 -
  static void idefloppy_create_prevent_cmd(struct ide_atapi_pc *pc, int 
 prevent)
  {
   debug_log(creating prevent removal command, prevent = %d\n, prevent);
 @@ -799,7 +779,6 @@ static void idefloppy_create_rw_cmd(idefloppy_floppy_t 

  1   2   3   4   5   6   7   8   9   10   >