Re: Serverworks Oops with the very latest git kernel...

2008-01-11 Thread Bartlomiej Zolnierkiewicz
On Friday 11 January 2008, Trond Myklebust wrote:
> 
> On Thu, 2008-01-10 at 21:24 -0500, Jeff Garzik wrote:
> > Trond Myklebust wrote:
> > > Hi,
> > > 
> > > I'm getting the following Oops on boot with kernel 2.6.24-rc7-g88fb61e4.
> > > 
> > > Starting udev: BUG: unable to handle kernel paging request at virtual 
> > > address 2d6d3a65
> > > printing eip: c04e1af1 *pde =  
> > > Oops:  [#1] PREEMPT SMP 
> > > Modules linked in: evdev evbug rtc_cmos pcspkr floppy rtc_core rtc_lib 
> > > shpchp pci_hotplug serverworks 
tg3 generic i2c_piix4 i2c_core
> > > 
> > > Pid: 1820, comm: modprobe Not tainted (2.6.24-rc7-g88fb61e4 #2)
> > > EIP: 0060:[] EFLAGS: 00210286 CPU: 0
> > > EIP is at strstr+0x11/0x34
> > > EAX:  EBX: 2d6d3a65 ECX:  EDX: 2d6d3a65
> > > ESI: c0513f75 EDI: 2d6d3a65 EBP: f65bccec ESP: f65bcce0
> > >  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
> > > Process modprobe (pid: 1820, ti=f65bc000 task=f795a2f0 task.ti=f65bc000)
> > > Stack: f8921a44 0001  f65bcd00 c054a0b9 f892e394 f892e080 
> > > f892e5f8 
> > >f65bcd20 f892133b c04d7c9d f892da80 f891d339 f892e394 f892e080 
> > > f892e5f8 
> > >f65bcd64 f891d11f f891d339 f891bc38 f892e080  0001 
> > >  
> > > Call Trace:
> > >  [] show_trace_log_lvl+0x1a/0x2f
> > >  [] show_stack_log_lvl+0x9d/0xa5
> > >  [] show_registers+0xa3/0x1df
> > >  [] die+0x121/0x204
> > >  [] do_page_fault+0x557/0x63e
> > >  [] error_code+0x72/0x78
> > >  [] dmi_check_system+0x2f/0x58
> > >  [] ide_acpi_init+0x28/0x195 [ide_core]
> > >  [] hwif_init+0x324/0x37c [ide_core]
> > >  [] ide_device_add+0x3b/0xa6 [ide_core]
> > >  [] ide_setup_pci_device+0x36/0x40 [ide_core]
> > >  [] svwks_init_one+0x5b/0x62 [serverworks]
> > >  [] pci_device_probe+0x39/0x5b
> > >  [] driver_probe_device+0xe9/0x16a
> > >  [] __driver_attach+0x6c/0xa5
> > >  [] bus_for_each_dev+0x36/0x5b
> > >  [] driver_attach+0x19/0x1b
> > >  [] bus_add_driver+0x73/0x1aa
> > >  [] driver_register+0x67/0x6c
> > >  [] __pci_register_driver+0x56/0x83
> > >  [] svwks_ide_init+0x17/0x19 [serverworks]
> > >  [] sys_init_module+0x15da/0x1715
> > >  [] sysenter_past_esp+0x5f/0xa5
> > >  ===
> > > Code: e5 89 c1 89 c8 eb 06 80 38 00 74 07 40 4a 83 fa ff 75 f4 29 c8 5d 
> > > c3 90 90 90 55 89 e5 57 56 53 89 
c6 89 d3 31 c0 83 c9 ff 89 
> > > EIP: [] strstr+0x11/0x34 SS:ESP 0068:f65bcce0
> > > ---[ end trace f0316f1e9ff3 ]---
> > > udevd-event[1819]: run_program: '/sbin/modprobe' abnormal exit
> > > 
> > > 
> > > Any ideas? As far as I can see, 2.6.24-rc7 itself is good, so I suspect
> > > the recent merge by Bart.
> > > 
> > > I've set up a bugzilla entry for the regression on
> > > http://bugzilla.kernel.org/show_bug.cgi?id=9728
> > 
> > Does this patch fix it?
> > 
> > Looks like an unterminated DMI table...

Eh, sorry for overlooking it during review...

> Yup. That seems to have solved it. Thanks Jeff!

Thanks guys.

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


libata in debian testing

2008-01-11 Thread Daniel Rode

seems to be updated.

regards,
Daniel Rode
-
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: terminate ACPI DMI list

2008-01-11 Thread Bartlomiej Zolnierkiewicz
On Friday 11 January 2008, Jeff Garzik wrote:
> Fix oops reported by Trond.
> 
> Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>

Acked-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>

Linus, could you apply it?

> ---
>  drivers/ide/ide-acpi.c |2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c
> index fe6768a..899d565 100644
> --- a/drivers/ide/ide-acpi.c
> +++ b/drivers/ide/ide-acpi.c
> @@ -85,6 +85,8 @@ static const struct dmi_system_id ide_acpi_dmi_table[] = {
>   DMI_MATCH(DMI_BIOS_VERSION, "KAM1.60")
>   },
>   },
> +
> + { } /* terminate list */
>  };
>  
>  static int ide_acpi_blacklist(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


Re: 40-wire cable detected when directly connected

2008-01-11 Thread Tobias Müller

Tejun Heo schrieb:

I don't know very well about CF but does it even fill UDMA/33?  What
does 'dd if=/dev/sdc of=/dev/null bs=1M count=16 iflag=direct' say?  You
can increase count for more reliable result.


16+0 Datensätze ein
16+0 Datensätze aus
16777216 Bytes (17 MB) kopiert, 0,561688 s, 29,9 MB/s

And hdparm -I /dev/sdc says it should be compatible to udma5.

/dev/sdc:

ATA device, with non-removable media
Model Number:   SanDisk SDCFX4-8192
Serial Number:  010611E2297S0510
Firmware Revision:  HDX 4.20
Standards:
Supported: 4
Likely used: 4
Configuration:
Logical max current
cylinders   15880   15880
heads   16  16
sectors/track   63  63
--
CHS current addressable sectors:   16007040
LBAuser addressable sectors:   16007040
device size with M = 1024*1024:7815 MBytes
device size with M = 1000*1000:8195 MBytes (8 GB)
Capabilities:
LBA, IORDY(may be)(cannot be disabled)
Standby timer values: spec'd by Vendor
R/W multiple sector transfer: Max = 4   Current = 0
DMA: mdma0 mdma1 mdma2 udma0 udma1 *udma2 udma3 udma4
 Cycle time: min=120ns recommended=120ns
PIO: pio0 pio1 pio2 pio3 pio4
 Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
Enabled Supported:
Write cache
   *CFA feature set



smime.p7s
Description: S/MIME Cryptographic Signature


[PATCH 19/21] ide-floppy: fix most of the remaining checkpatch.pl issues

2008-01-11 Thread Borislav Petkov
i.e.,
ERROR: switch and case should be at the same indent
ERROR: need spaces around that '=' (ctx:VxV)
ERROR: trailing statements should be on next line
WARNING: no space between function name and open parenthesis '('
WARNING: printk() should include KERN_ facility level
ERROR: That open brace { should be on the previous line
ERROR: use tabs not spaces
ERROR: do not use assignment in if condition
WARNING: braces {} are not necessary for single statement blocks
ERROR: need space after that ',' (ctx:VxV)
WARNING: line over 80 characters
ERROR: do not use assignment in if condition
...

Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
---
 drivers/ide/ide-floppy.c |  147 +++--
 1 files changed, 75 insertions(+), 72 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 0729df5..3d9b1e5 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -47,13 +47,13 @@
 #define IDEFLOPPY_DEBUG_INFO   0
 #define IDEFLOPPY_DEBUG_BUGS   1
 
-#define IDEFLOPPY_DEBUG( fmt, args... )
+#define IDEFLOPPY_DEBUG(fmt, args...)
 
 #if IDEFLOPPY_DEBUG_LOG
 #define debug_log(fmt, args...) \
printk(KERN_INFO "ide-floppy: " fmt, ## args)
 #else
-#define debug_log(fmt, args... ) do {} while(0)
+#define debug_log(fmt, args...) do {} while (0)
 #endif
 
 
@@ -275,9 +275,9 @@ static int idefloppy_do_end_request(ide_drive_t *drive, int 
uptodate, int nsecs)
debug_log("Reached %s\n", __FUNCTION__);
 
switch (uptodate) {
-   case 0: error = IDEFLOPPY_ERROR_GENERAL; break;
-   case 1: error = 0; break;
-   default: error = uptodate;
+   case 0: error = IDEFLOPPY_ERROR_GENERAL; break;
+   case 1: error = 0; break;
+   default: error = uptodate;
}
if (error)
floppy->failed_pc = NULL;
@@ -396,7 +396,7 @@ static idefloppy_pc_t 
*idefloppy_next_pc_storage(ide_drive_t *drive)
idefloppy_floppy_t *floppy = drive->driver_data;
 
if (floppy->pc_stack_index == IDEFLOPPY_PC_STACK)
-   floppy->pc_stack_index=0;
+   floppy->pc_stack_index = 0;
return (&floppy->pc_stack[floppy->pc_stack_index++]);
 }
 
@@ -526,7 +526,8 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
/* Clear the interrupt */
stat = drive->hwif->INB(IDE_STATUS_REG);
 
-   if ((stat & DRQ_STAT) == 0) {   /* No more interrupts */
+   if ((stat & DRQ_STAT) == 0) {
+   /* No more interrupts */
debug_log("Packet command completed, %d bytes transferred\n",
pc->actually_transferred);
clear_bit(PC_DMA_IN_PROGRESS, &pc->flags);
@@ -771,7 +772,8 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t 
*drive,
ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK |
   IDE_TFLAG_OUT_DEVICE, bcount, dma);
 
-   if (dma) {  /* Begin DMA, if necessary */
+   if (dma) {
+   /* Begin DMA, if necessary */
set_bit(PC_DMA_IN_PROGRESS, &pc->flags);
hwif->dma_start(drive);
}
@@ -785,7 +787,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t 
*drive,
pkt_xfer_routine = &idefloppy_transfer_pc;
}
 
-   if (test_bit (IDEFLOPPY_DRQ_INTERRUPT, &floppy->flags)) {
+   if (test_bit(IDEFLOPPY_DRQ_INTERRUPT, &floppy->flags)) {
/* Issue the packet command */
ide_execute_command(drive, WIN_PACKETCMD,
pkt_xfer_routine,
@@ -842,7 +844,7 @@ static void idefloppy_create_format_unit_cmd(idefloppy_pc_t 
*pc, int b, int l,
 
put_unaligned(cpu_to_be32(b), (unsigned int *)(&pc->buffer[4]));
put_unaligned(cpu_to_be32(l), (unsigned int *)(&pc->buffer[8]));
-   pc->buffer_size=12;
+   pc->buffer_size = 12;
set_bit(PC_WRITING, &pc->flags);
 }
 
@@ -858,15 +860,15 @@ static void 
idefloppy_create_mode_sense_cmd(idefloppy_pc_t *pc, u8 page_code,
pc->c[2] = page_code + (type << 6);
 
switch (page_code) {
-   case IDEFLOPPY_CAPABILITIES_PAGE:
-   length += 12;
-   break;
-   case IDEFLOPPY_FLEXIBLE_DISK_PAGE:
-   length += 32;
-   break;
-   default:
-   printk(KERN_ERR "ide-floppy: unsupported page code "
-   "in create_mode_sense_cmd\n");
+   case IDEFLOPPY_CAPABILITIES_PAGE:
+   length += 12;
+   break;
+   case IDEFLOPPY_FLEXIBLE_DISK_PAGE:
+   length += 32;
+   break;
+   default:
+   printk(KERN_ERR "ide-floppy: unsupported page code in %s\n",
+   __FUNCTION__);
}
put_unaligned(cpu_to_be16(length), (u16 *) &pc->c[7]);
pc->request_transfer = le

[PATCH 12/21] ide-floppy: factor out ioctl handlers from idefloppy_ioctl()

2008-01-11 Thread Borislav Petkov
By passing idefloppy_floppy_t *floppy to the factored out functions, we get
rid of (almost) all local vars so stack usage should be at minimum here. Also,
we merge idefloppy_begin_format() into idefloppy_format_start() since it is its
only user.

Also,
- remove unneeded scsi ioctl chunk
- rename idefloppy_format_start to idefloppy_format_unit

Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
---
 drivers/ide/ide-floppy.c |  169 +
 1 files changed, 79 insertions(+), 90 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 5d612e7..a33d651 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -1244,44 +1244,6 @@ static int idefloppy_get_format_capacities(ide_drive_t 
*drive, int __user *arg)
 }
 
 /*
- * Send ATAPI_FORMAT_UNIT to the drive.
- *
- * Userland gives us the following structure:
- *
- * struct idefloppy_format_command {
- *int nblocks;
- *int blocksize;
- *int flags;
- *} ;
- *
- * flags is a bitmask, currently, the only defined flag is:
- *
- *0x01 - verify media after format.
- */
-
-static int idefloppy_begin_format(ide_drive_t *drive, int __user *arg)
-{
-   int blocks;
-   int length;
-   int flags;
-   idefloppy_pc_t pc;
-
-   if (get_user(blocks, arg) ||
-   get_user(length, arg+1) ||
-   get_user(flags, arg+2)) {
-   return (-EFAULT);
-   }
-
-   (void) idefloppy_get_sfrp_bit(drive);
-   idefloppy_create_format_unit_cmd(&pc, blocks, length, flags);
-   if (idefloppy_queue_pc_tail(drive, &pc)) {
-return (-EIO);
-   }
-
-   return (0);
-}
-
-/*
  * Get ATAPI_FORMAT_UNIT progress indication.
  *
  * Userland gives a pointer to an int.  The int is set to a progress
@@ -1623,6 +1585,82 @@ static int idefloppy_getgeo(struct block_device *bdev, 
struct hd_geometry *geo)
return 0;
 }
 
+static int idefloppy_lockdoor(idefloppy_floppy_t *floppy, idefloppy_pc_t *pc,
+   unsigned long arg, unsigned int cmd)
+{
+   if (floppy->openers > 1)
+   return -EBUSY;
+
+   /* The IOMEGA Clik! Drive doesn't support this command -
+* no room for an eject mechanism */
+   if (!test_bit(IDEFLOPPY_CLIK_DRIVE, &floppy->flags)) {
+   int prevent = (arg) ? 1 : 0;
+
+   if (cmd == CDROMEJECT)
+   prevent = 0;
+
+   idefloppy_create_prevent_cmd(pc, prevent);
+   (void) idefloppy_queue_pc_tail(floppy->drive, pc);
+   }
+
+   if (cmd == CDROMEJECT) {
+   idefloppy_create_start_stop_cmd(pc, 2);
+   (void) idefloppy_queue_pc_tail(floppy->drive, pc);
+   }
+
+   return 0;
+}
+
+static int idefloppy_format_unit(idefloppy_floppy_t *floppy, unsigned long arg)
+{
+   int blocks, length, flags, err = 0;
+   int __user *argp = (int __user *)arg;
+   idefloppy_pc_t pc;
+
+   if (floppy->openers > 1) {
+   /* Don't format if someone is using the disk */
+   clear_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, &floppy->flags);
+   return -EBUSY;
+   }
+
+   set_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, &floppy->flags);
+
+   /*
+* Send ATAPI_FORMAT_UNIT to the drive.
+*
+* Userland gives us the following structure:
+*
+* struct idefloppy_format_command {
+*int nblocks;
+*int blocksize;
+*int flags;
+*} ;
+*
+* flags is a bitmask, currently, the only defined flag is:
+*
+*0x01 - verify media after format.
+*/
+   if (get_user(blocks, argp) ||
+   get_user(length, argp+1) ||
+   get_user(flags, argp+2)) {
+   err = -EFAULT;
+   goto out;
+   }
+
+   (void) idefloppy_get_sfrp_bit(floppy->drive);
+   idefloppy_create_format_unit_cmd(&pc, blocks, length, flags);
+
+   if (idefloppy_queue_pc_tail(floppy->drive, &pc)) {
+   err = -EIO;
+   goto out;
+   }
+
+out:
+   if (err)
+   clear_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, &floppy->flags);
+   return err;
+}
+
 static int idefloppy_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
 {
@@ -1630,75 +1668,26 @@ static int idefloppy_ioctl(struct inode *inode, struct 
file *file,
struct ide_floppy_obj *floppy = ide_floppy_g(bdev->bd_disk);
ide_drive_t *drive = floppy->drive;
void __user *argp = (void __user *)arg;
-   int err;
-   int prevent = (arg) ? 1 : 0;
idefloppy_pc_t pc;
 
switch (cmd) {
case CDROMEJECT:
-   prevent = 0;
/* fall through */
case CDROM_LOCKDOOR:
-   if (floppy->openers > 1)
-   return -EBUSY;
-
- 

[PATCH 15/21] ide-floppy: disambiguate function names

2008-01-11 Thread Borislav Petkov
There were two almost identical function names in ide-floppy.c, which makes 
their
distinction almost impossible. While ide_floppy_release() cleans up the object
after the last reference to it has been dropped, idefloppy_release() is the 
blkdev
.release method from struct block_device_operations which releases that last 
reference.

Rename ide_floppy_release() to idefloppy_cleanup_obj() in order to make its 
purpose
more clear. There should be no functionality change resulting from this patch.

Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
---
 drivers/ide/ide-floppy.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index b718615..6e8926a 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -234,12 +234,12 @@ static struct ide_floppy_obj *ide_floppy_get(struct 
gendisk *disk)
return floppy;
 }
 
-static void ide_floppy_release(struct kref *);
+static void idefloppy_cleanup_obj(struct kref *);
 
 static void ide_floppy_put(struct ide_floppy_obj *floppy)
 {
mutex_lock(&idefloppy_ref_mutex);
-   kref_put(&floppy->kref, ide_floppy_release);
+   kref_put(&floppy->kref, idefloppy_cleanup_obj);
mutex_unlock(&idefloppy_ref_mutex);
 }
 
@@ -1431,7 +1431,7 @@ static void ide_floppy_remove(ide_drive_t *drive)
ide_floppy_put(floppy);
 }
 
-static void ide_floppy_release(struct kref *kref)
+static void idefloppy_cleanup_obj(struct kref *kref)
 {
struct ide_floppy_obj *floppy = to_ide_floppy(kref);
ide_drive_t *drive = floppy->drive;
-- 
1.5.3.7

-
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/21] ide-floppy: remove struct idefloppy_capacity_descriptor

2008-01-11 Thread Borislav Petkov
We test here for updated capacity descriptors by checking whether the media
has changed instead of memcmp-ing with a cached copy of the capacity
descriptors.

Also:

- remove one of 2 consecutive if (!i)-tests.
- start loop at 1 in idefloppy_get_format_capacities() since userspace doesn't
need the current/maximum capacity descriptor. i.e the first one.
- fix comments formatting

Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
---
 drivers/ide/ide-floppy.c |  132 +
 1 files changed, 50 insertions(+), 82 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 679d48e..5c85833 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -119,29 +119,7 @@ typedef struct idefloppy_packet_command_s {
 
 #definePC_SUPPRESS_ERROR   6   /* Suppress error 
reporting */
 
-/*
- * Format capacity
- */
-typedef struct {
-   u8  reserved[3];
-   u8  length; /* Length of the following 
descriptors in bytes */
-} idefloppy_capacity_header_t;
-
-typedef struct {
-   u32 blocks; /* Number of blocks */
-#if defined(__LITTLE_ENDIAN_BITFIELD)
-   unsigneddc  :2; /* Descriptor Code */
-   unsignedreserved:6;
-#elif defined(__BIG_ENDIAN_BITFIELD)
-   unsignedreserved:6;
-   unsigneddc  :2; /* Descriptor Code */
-#else
-#error "Bitfield endianness not defined! Check your byteorder.h"
-#endif
-   u8  length_msb; /* Block Length (MSB)*/
-   u16 length; /* Block Length */
-} idefloppy_capacity_descriptor_t;
-
+/* format capacities descriptor codes */
 #define CAPACITY_INVALID   0x00
 #define CAPACITY_UNFORMATTED   0x01
 #define CAPACITY_CURRENT   0x02
@@ -184,8 +162,6 @@ typedef struct ide_floppy_obj {
 */
/* Current format */
int blocks, block_size, bs_factor;
-   /* Last format capacity */
-   idefloppy_capacity_descriptor_t capacity;
/* Write protect */
int wp;
/* Supports format progress report */
@@ -1229,17 +1205,16 @@ static int idefloppy_get_sfrp_bit(ide_drive_t *drive)
 }
 
 /*
- * Determine if a media is present in the floppy drive, and if so,
- * its LBA capacity.
+ * Determine if a media is present in the floppy drive, and if so, its LBA
+ * capacity.
  */
-static int idefloppy_get_capacity (ide_drive_t *drive)
+static int idefloppy_get_capacity(ide_drive_t *drive)
 {
idefloppy_floppy_t *floppy = drive->driver_data;
idefloppy_pc_t pc;
-   idefloppy_capacity_header_t *header;
-   idefloppy_capacity_descriptor_t *descriptor;
-   int i, descriptors, rc = 1, blocks, length;
-   
+   int i, desc_cnt, rc = 1, blocks, length;
+   u8 header_len;
+
drive->bios_cyl = 0;
drive->bios_head = drive->bios_sect = 0;
floppy->blocks = 0;
@@ -1251,17 +1226,17 @@ static int idefloppy_get_capacity (ide_drive_t *drive)
printk(KERN_ERR "ide-floppy: Can't get floppy parameters\n");
return 1;
}
-   header = (idefloppy_capacity_header_t *) pc.buffer;
-   descriptors = header->length / sizeof(idefloppy_capacity_descriptor_t);
-   descriptor = (idefloppy_capacity_descriptor_t *) (header + 1);
+   header_len = pc.buffer[3];
+   desc_cnt = header_len / 8; /* capacity descriptor of 8 bytes */
 
-   for (i = 0; i < descriptors; i++, descriptor++) {
-   blocks = descriptor->blocks = be32_to_cpu(descriptor->blocks);
-   length = descriptor->length = be16_to_cpu(descriptor->length);
+   for (i = 0; i < desc_cnt; i++) {
+   unsigned int desc_start = 4 + i*8;
+   blocks = be32_to_cpu(*(u32 *)&pc.buffer[desc_start]);
+   length = be16_to_cpu(*(u16 *)&pc.buffer[desc_start + 6]);
 
-   if (!i) 
+   if (!i)
{
-   switch (descriptor->dc) {
+   switch (pc.buffer[desc_start + 4] & 0x03) {
/* Clik! drive returns this instead of CAPACITY_CURRENT */
case CAPACITY_UNFORMATTED:
if (!test_bit(IDEFLOPPY_CLIK_DRIVE, &floppy->flags))
@@ -1272,11 +1247,11 @@ static int idefloppy_get_capacity (ide_drive_t *drive)
break;
case CAPACITY_CURRENT:
/* Normal Zip/LS-120 disks */
-   if (memcmp(descriptor, &floppy->capacity, sizeof 
(idefloppy_capacity_descriptor_t)))
+   if ((1UL << IDEFLOPPY_MEDIA_CHANGED) & floppy->flags)
printk(KERN_INFO "%s: %dkB, %d blocks, %d "
"sector size\n", drive->name,
blocks * length / 1024, blocks, length);
-   

[PATCH 06/21] ide-floppy: remove struct idefloppy_flexible_disk_page

2008-01-11 Thread Borislav Petkov
The driver used to test whether the flexible disk page has changed by memcmp-ing
it with a cached copy of a previous version of the page from a different remo-
vable medium. Since, according to the SFF-8070i spec, the flexible disk page
"specifies parameters relating to the currently installed medium type," this
comparison is now done by simply checking whether the medium has changed.

Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
---
 drivers/ide/ide-floppy.c |   89 -
 1 files changed, 32 insertions(+), 57 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 2b9885f..679d48e 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -120,33 +120,6 @@ typedef struct idefloppy_packet_command_s {
 #definePC_SUPPRESS_ERROR   6   /* Suppress error 
reporting */
 
 /*
- * Flexible disk page.
- */
-typedef struct {
-#if defined(__LITTLE_ENDIAN_BITFIELD)
-   unsignedpage_code   :6; /* Page code - Should be 0x5 */
-   unsignedreserved1_6 :1; /* Reserved */
-   unsignedps  :1; /* The device is capable of 
saving the page */
-#elif defined(__BIG_ENDIAN_BITFIELD)
-   unsignedps  :1; /* The device is capable of 
saving the page */
-   unsignedreserved1_6 :1; /* Reserved */
-   unsignedpage_code   :6; /* Page code - Should be 0x5 */
-#else
-#error "Bitfield endianness not defined! Check your byteorder.h"
-#endif
-   u8  page_length;/* Page Length - Should be 0x1e 
*/
-   u16 transfer_rate;  /* In kilobits per second */
-   u8  heads, sectors; /* Number of heads, Number of 
sectors per track */
-   u16 sector_size;/* Byes per sector */
-   u16 cyls;   /* Number of cylinders */
-   u8  reserved10[10];
-   u8  motor_delay;/* Motor off delay */
-   u8  reserved21[7];
-   u16 rpm;/* Rotations per minute */
-   u8  reserved30[2];
-} idefloppy_flexible_disk_page_t;
- 
-/*
  * Format capacity
  */
 typedef struct {
@@ -213,8 +186,6 @@ typedef struct ide_floppy_obj {
int blocks, block_size, bs_factor;
/* Last format capacity */
idefloppy_capacity_descriptor_t capacity;
-   /* Copy of the flexible disk page */
-   idefloppy_flexible_disk_page_t flexible_disk_page;
/* Write protect */
int wp;
/* Supports format progress report */
@@ -1188,50 +1159,54 @@ static int idefloppy_queue_pc_tail (ide_drive_t 
*drive,idefloppy_pc_t *pc)
 }
 
 /*
- * Look at the flexible disk page parameters. We will ignore the CHS
- * capacity parameters and use the LBA parameters instead.
+ * Look at the flexible disk page parameters. We will ignore the CHS capacity
+ * parameters and use the LBA parameters instead.
  */
-static int idefloppy_get_flexible_disk_page (ide_drive_t *drive)
+static int idefloppy_get_flexible_disk_page(ide_drive_t *drive)
 {
idefloppy_floppy_t *floppy = drive->driver_data;
idefloppy_pc_t pc;
-   idefloppy_mode_parameter_header_t *header;
-   idefloppy_flexible_disk_page_t *page;
int capacity, lba_capacity;
+   u8 heads, sectors;
+   u16 transfer_rate, sector_size, cyls, rpm;
 
-   idefloppy_create_mode_sense_cmd(&pc, IDEFLOPPY_FLEXIBLE_DISK_PAGE, 
MODE_SENSE_CURRENT);
-   if (idefloppy_queue_pc_tail(drive,&pc)) {
-   printk(KERN_ERR "ide-floppy: Can't get flexible disk "
-   "page parameters\n");
+   idefloppy_create_mode_sense_cmd(&pc, IDEFLOPPY_FLEXIBLE_DISK_PAGE,
+   MODE_SENSE_CURRENT);
+
+   if (idefloppy_queue_pc_tail(drive, &pc)) {
+   printk(KERN_ERR "ide-floppy: Can't get flexible disk page"
+   " parameters\n");
return 1;
}
-   header = (idefloppy_mode_parameter_header_t *) pc.buffer;
-   floppy->wp = header->wp;
+   floppy->wp = pc.buffer[3] & 0x80;
set_disk_ro(floppy->disk, floppy->wp);
-   page = (idefloppy_flexible_disk_page_t *) (header + 1);
-
-   page->transfer_rate = be16_to_cpu(page->transfer_rate);
-   page->sector_size = be16_to_cpu(page->sector_size);
-   page->cyls = be16_to_cpu(page->cyls);
-   page->rpm = be16_to_cpu(page->rpm);
-   capacity = page->cyls * page->heads * page->sectors * page->sector_size;
-   if (memcmp (page, &floppy->flexible_disk_page, sizeof 
(idefloppy_flexible_disk_page_t)))
+
+   transfer_rate = be16_to_cpu(*(u16 *)&pc.buffer[8 + 2]);
+   sector_size   = be16_to_cpu(*(u16 *)&pc.buffer[8 + 6]);
+   cyls  = be16_to_cpu(*(u16 *)&pc.buffer[8 + 8]);
+   rpm   = be16_to_cpu(*

[PATCH 01/21] ide-floppy: convert to generic packet commands

2008-01-11 Thread Borislav Petkov
Replace the ide-floppy packet commands opcode defines with the generic ones.
Add a missing GPCMD_WRITE_12 (opcode 0xaa) to the generic ones in cdrom.h. The
last one can be found in the current version of INF-8090, p.905.

CC: Jens Axboe <[EMAIL PROTECTED]>
Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
---
 drivers/ide/ide-floppy.c |   44 
 include/linux/cdrom.h|1 +
 2 files changed, 13 insertions(+), 32 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 3512637..e4ebb21 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -273,26 +273,6 @@ typedef struct ide_floppy_obj {
 #define IDEFLOPPY_ZIP_DRIVE5   /* Requires BH algorithm for 
packets */
 
 /*
- * ATAPI floppy drive packet commands
- */
-#define IDEFLOPPY_FORMAT_UNIT_CMD  0x04
-#define IDEFLOPPY_INQUIRY_CMD  0x12
-#define IDEFLOPPY_MODE_SELECT_CMD  0x55
-#define IDEFLOPPY_MODE_SENSE_CMD   0x5a
-#define IDEFLOPPY_READ10_CMD   0x28
-#define IDEFLOPPY_READ12_CMD   0xa8
-#define IDEFLOPPY_READ_CAPACITY_CMD0x23
-#define IDEFLOPPY_REQUEST_SENSE_CMD0x03
-#define IDEFLOPPY_PREVENT_REMOVAL_CMD  0x1e
-#define IDEFLOPPY_SEEK_CMD 0x2b
-#define IDEFLOPPY_START_STOP_CMD   0x1b
-#define IDEFLOPPY_TEST_UNIT_READY_CMD  0x00
-#define IDEFLOPPY_VERIFY_CMD   0x2f
-#define IDEFLOPPY_WRITE10_CMD  0x2a
-#define IDEFLOPPY_WRITE12_CMD  0xaa
-#define IDEFLOPPY_WRITE_VERIFY_CMD 0x2e
-
-/*
  * Defines for the mode sense command
  */
 #define MODE_SENSE_CURRENT 0x00
@@ -696,8 +676,8 @@ static void idefloppy_init_pc (idefloppy_pc_t *pc)
 
 static void idefloppy_create_request_sense_cmd (idefloppy_pc_t *pc)
 {
-   idefloppy_init_pc(pc);  
-   pc->c[0] = IDEFLOPPY_REQUEST_SENSE_CMD;
+   idefloppy_init_pc(pc);
+   pc->c[0] = GPCMD_REQUEST_SENSE;
pc->c[4] = 255;
pc->request_transfer = 18;
pc->callback = &idefloppy_request_sense_callback;
@@ -762,7 +742,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t 
*drive)
debug_log(KERN_INFO "ide-floppy: %s: I/O error\n",
drive->name);
rq->errors++;
-   if (pc->c[0] == IDEFLOPPY_REQUEST_SENSE_CMD) {
+   if (pc->c[0] == GPCMD_REQUEST_SENSE) {
printk(KERN_ERR "ide-floppy: I/O error in "
"request sense command\n");
return ide_do_reset(drive);
@@ -962,7 +942,7 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t 
*drive, idefloppy_pc_t *p
u8 dma;
 
if (floppy->failed_pc == NULL &&
-   pc->c[0] != IDEFLOPPY_REQUEST_SENSE_CMD)
+   pc->c[0] != GPCMD_REQUEST_SENSE)
floppy->failed_pc = pc;
/* Set the current packet command */
floppy->pc = pc;
@@ -1052,14 +1032,14 @@ static void idefloppy_create_prevent_cmd 
(idefloppy_pc_t *pc, int prevent)
"prevent = %d\n", prevent);
 
idefloppy_init_pc(pc);
-   pc->c[0] = IDEFLOPPY_PREVENT_REMOVAL_CMD;
+   pc->c[0] = GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL;
pc->c[4] = prevent;
 }
 
 static void idefloppy_create_read_capacity_cmd (idefloppy_pc_t *pc)
 {
idefloppy_init_pc(pc);
-   pc->c[0] = IDEFLOPPY_READ_CAPACITY_CMD;
+   pc->c[0] = GPCMD_READ_FORMAT_CAPACITIES;
pc->c[7] = 255;
pc->c[8] = 255;
pc->request_transfer = 255;
@@ -1069,7 +1049,7 @@ static void idefloppy_create_format_unit_cmd 
(idefloppy_pc_t *pc, int b, int l,
  int flags)
 {
idefloppy_init_pc(pc);
-   pc->c[0] = IDEFLOPPY_FORMAT_UNIT_CMD;
+   pc->c[0] = GPCMD_FORMAT_UNIT;
pc->c[1] = 0x17;
 
memset(pc->buffer, 0, 12);
@@ -1094,7 +1074,7 @@ static void idefloppy_create_mode_sense_cmd 
(idefloppy_pc_t *pc, u8 page_code, u
u16 length = sizeof(idefloppy_mode_parameter_header_t);

idefloppy_init_pc(pc);
-   pc->c[0] = IDEFLOPPY_MODE_SENSE_CMD;
+   pc->c[0] = GPCMD_MODE_SENSE_10;
pc->c[1] = 0;
pc->c[2] = page_code + (type << 6);
 
@@ -1116,14 +1096,14 @@ static void idefloppy_create_mode_sense_cmd 
(idefloppy_pc_t *pc, u8 page_code, u
 static void idefloppy_create_start_stop_cmd (idefloppy_pc_t *pc, int start)
 {
idefloppy_init_pc(pc);
-   pc->c[0] = IDEFLOPPY_START_STOP_CMD;
+   pc->c[0] = GPCMD_START_STOP_UNIT;
pc->c[4] = start;
 }
 
 static void idefloppy_create_test_unit_ready_cmd(idefloppy_pc_t *pc)
 {
idefloppy_init_pc(pc);
-   pc->c[0] = IDEFLOPPY_TEST_UNIT_READY_CMD;
+   pc->c[0] = GPCMD_TEST_UNIT_READY;
 }
 
 static void idefloppy_create_rw_cmd (idefloppy_floppy_t *floppy, 
idefloppy_pc_t *pc, struct request *rq, unsigned long sector)
@@ -1138,10 +1118,10 

[PATCH 18/21] ide-floppy: fix error handling in idefloppy_probe()

2008-01-11 Thread Borislav Petkov
Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
---
 drivers/ide/ide-floppy.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 89b26ea..0729df5 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -1737,7 +1737,8 @@ static int ide_floppy_probe(ide_drive_t *drive)
" emulation.\n", drive->name);
goto failed;
}
-   if ((floppy = kzalloc(sizeof (idefloppy_floppy_t), GFP_KERNEL)) == 
NULL) {
+   floppy = kzalloc(sizeof(idefloppy_floppy_t), GFP_KERNEL);
+   if (!floppy) {
printk(KERN_ERR "ide-floppy: %s: Can't allocate a floppy"
" structure\n", drive->name);
goto failed;
-- 
1.5.3.7

-
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 05/21] ide-floppy: remove struct idefloppy_capabilities_page

2008-01-11 Thread Borislav Petkov
BIG FAT WARNING: This patch has already been applied to Bart's quilt tree!

This change is rather temporary and is in preparation of using generic commands
as is the case with ide-cd and the uniform cdrom layer (i.e. 
init_cdrom_command())
However, before this happens, we'll have to remove all typedefs and teach
idefloppy_create_mode_sense_cmd() to work directly on u8 buffers.

Also, since idefloppy_get_capability_page() was used to read only the sfrp bit,
rename the latter so that the name reflects what it does.

Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
---
 drivers/ide/ide-floppy.c |   55 +-
 1 files changed, 6 insertions(+), 49 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index e8fe8ef..2b9885f 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -120,44 +120,6 @@ typedef struct idefloppy_packet_command_s {
 #definePC_SUPPRESS_ERROR   6   /* Suppress error 
reporting */
 
 /*
- * Removable Block Access Capabilities Page
- */
-typedef struct {
-#if defined(__LITTLE_ENDIAN_BITFIELD)
-   unsignedpage_code   :6; /* Page code - Should be 0x1b */
-   unsignedreserved1_6 :1; /* Reserved */
-   unsignedps  :1; /* Should be 0 */
-#elif defined(__BIG_ENDIAN_BITFIELD)
-   unsignedps  :1; /* Should be 0 */
-   unsignedreserved1_6 :1; /* Reserved */
-   unsignedpage_code   :6; /* Page code - Should be 0x1b */
-#else
-#error "Bitfield endianness not defined! Check your byteorder.h"
-#endif
-   u8  page_length;/* Page Length - Should be 0xa 
*/
-#if defined(__LITTLE_ENDIAN_BITFIELD)
-   unsignedreserved2   :6;
-   unsignedsrfp:1; /* Supports reporting progress 
of format */
-   unsignedsflp:1; /* System floppy type device */
-   unsignedtlun:3; /* Total logical units 
supported by the device */
-   unsignedreserved3   :3;
-   unsignedsml :1; /* Single / Multiple lun 
supported */
-   unsignedncd :1; /* Non cd optical device */
-#elif defined(__BIG_ENDIAN_BITFIELD)
-   unsignedsflp:1; /* System floppy type device */
-   unsignedsrfp:1; /* Supports reporting progress 
of format */
-   unsignedreserved2   :6;
-   unsignedncd :1; /* Non cd optical device */
-   unsignedsml :1; /* Single / Multiple lun 
supported */
-   unsignedreserved3   :3;
-   unsignedtlun:3; /* Total logical units 
supported by the device */
-#else
-#error "Bitfield endianness not defined! Check your byteorder.h"
-#endif
-   u8  reserved[8];
-} idefloppy_capabilities_page_t;
-
-/*
  * Flexible disk page.
  */
 typedef struct {
@@ -397,7 +359,8 @@ typedef struct {
 } idefloppy_request_sense_result_t;
 
 /*
- * Pages of the SELECT SENSE / MODE SENSE packet commands.
+ * Pages of the SELECT SENSE / MODE SENSE packet commands.
+ * See SFF-8070i spec.
  */
 #defineIDEFLOPPY_CAPABILITIES_PAGE 0x1b
 #define IDEFLOPPY_FLEXIBLE_DISK_PAGE   0x05
@@ -1273,25 +1236,20 @@ static int idefloppy_get_flexible_disk_page 
(ide_drive_t *drive)
return 0;
 }
 
-static int idefloppy_get_capability_page(ide_drive_t *drive)
+static int idefloppy_get_sfrp_bit(ide_drive_t *drive)
 {
idefloppy_floppy_t *floppy = drive->driver_data;
idefloppy_pc_t pc;
-   idefloppy_mode_parameter_header_t *header;
-   idefloppy_capabilities_page_t *page;
 
floppy->srfp = 0;
idefloppy_create_mode_sense_cmd(&pc, IDEFLOPPY_CAPABILITIES_PAGE,
 MODE_SENSE_CURRENT);
 
set_bit(PC_SUPPRESS_ERROR, &pc.flags);
-   if (idefloppy_queue_pc_tail(drive,&pc)) {
+   if (idefloppy_queue_pc_tail(drive, &pc))
return 1;
-   }
 
-   header = (idefloppy_mode_parameter_header_t *) pc.buffer;
-   page= (idefloppy_capabilities_page_t *)(header+1);
-   floppy->srfp = page->srfp;
+   floppy->srfp = pc.buffer[8 + 2] & 0x40;
return (0);
 }
 
@@ -1497,8 +1455,7 @@ static int idefloppy_begin_format(ide_drive_t *drive, int 
__user *arg)
return (-EFAULT);
}
 
-   /* Get the SFRP bit */
-   (void) idefloppy_get_capability_page(drive);
+   (void) idefloppy_get_sfrp_bit(drive);
idefloppy_create_format_unit_cmd(&pc, blocks, length, flags);
if (idefloppy_queue_pc_tail(drive, &pc)) {
 return (-EIO);
-- 
1.5.3.7

-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at 

[PATCH 10/21] ide-floppy: remove struct idefloppy_mode_parameter_header

2008-01-11 Thread Borislav Petkov
Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
---
 drivers/ide/ide-floppy.c |   25 -
 1 files changed, 4 insertions(+), 21 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 7d4ac0b..11c2c9b 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -238,24 +238,6 @@ struct idefloppy_id_gcw {
 #defineIDEFLOPPY_CAPABILITIES_PAGE 0x1b
 #define IDEFLOPPY_FLEXIBLE_DISK_PAGE   0x05
 
-/*
- * Mode Parameter Header for the MODE SENSE packet command
- */
-typedef struct {
-   u16 mode_data_length;   /* Length of the following data 
transfer */
-   u8  medium_type;/* Medium Type */
-#if defined(__LITTLE_ENDIAN_BITFIELD)
-   unsignedreserved3   :7;
-   unsignedwp  :1; /* Write protect */
-#elif defined(__BIG_ENDIAN_BITFIELD)
-   unsignedwp  :1; /* Write protect */
-   unsignedreserved3   :7;
-#else
-#error "Bitfield endianness not defined! Check your byteorder.h"
-#endif
-   u8  reserved[4];
-} idefloppy_mode_parameter_header_t;
-
 static DEFINE_MUTEX(idefloppy_ref_mutex);
 
 #define to_ide_floppy(obj) container_of(obj, struct ide_floppy_obj, kref)
@@ -899,10 +881,11 @@ static void idefloppy_create_format_unit_cmd 
(idefloppy_pc_t *pc, int b, int l,
 /*
  * A mode sense command is used to "sense" floppy parameters.
  */
-static void idefloppy_create_mode_sense_cmd (idefloppy_pc_t *pc, u8 page_code, 
u8 type)
+static void idefloppy_create_mode_sense_cmd(idefloppy_pc_t *pc, u8 page_code,
+   u8 type)
 {
-   u16 length = sizeof(idefloppy_mode_parameter_header_t);
-   
+   u16 length = 8; /* sizeof(Mode Parameter Header) = 8 Bytes */
+
idefloppy_init_pc(pc);
pc->c[0] = GPCMD_MODE_SENSE_10;
pc->c[1] = 0;
-- 
1.5.3.7

-
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 08/21] ide-floppy: remove struct idefloppy_inquiry_result

2008-01-11 Thread Borislav Petkov
Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
---
 drivers/ide/ide-floppy.c |   41 -
 1 files changed, 0 insertions(+), 41 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 5c85833..d98264e 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -232,47 +232,6 @@ struct idefloppy_id_gcw {
 };
 
 /*
- * INQUIRY packet command - Data Format
- */
-typedef struct {
-#if defined(__LITTLE_ENDIAN_BITFIELD)
-   unsigneddevice_type :5; /* Peripheral Device Type */
-   unsignedreserved0_765   :3; /* Peripheral Qualifier - 
Reserved */
-   unsignedreserved1_6t0   :7; /* Reserved */
-   unsignedrmb :1; /* Removable Medium Bit */
-   unsignedansi_version:3; /* ANSI Version */
-   unsignedecma_version:3; /* ECMA Version */
-   unsignediso_version :2; /* ISO Version */
-   unsignedresponse_format :4; /* Response Data Format */
-   unsignedreserved3_45:2; /* Reserved */
-   unsignedreserved3_6 :1; /* TrmIOP - Reserved */
-   unsignedreserved3_7 :1; /* AENC - Reserved */
-#elif defined(__BIG_ENDIAN_BITFIELD)
-   unsignedreserved0_765   :3; /* Peripheral Qualifier - 
Reserved */
-   unsigneddevice_type :5; /* Peripheral Device Type */
-   unsignedrmb :1; /* Removable Medium Bit */
-   unsignedreserved1_6t0   :7; /* Reserved */
-   unsignediso_version :2; /* ISO Version */
-   unsignedecma_version:3; /* ECMA Version */
-   unsignedansi_version:3; /* ANSI Version */
-   unsignedreserved3_7 :1; /* AENC - Reserved */
-   unsignedreserved3_6 :1; /* TrmIOP - Reserved */
-   unsignedreserved3_45:2; /* Reserved */
-   unsignedresponse_format :4; /* Response Data Format */
-#else
-#error "Bitfield endianness not defined! Check your byteorder.h"
-#endif
-   u8  additional_length;  /* Additional Length 
(total_length-4) */
-   u8  rsv5, rsv6, rsv7;   /* Reserved */
-   u8  vendor_id[8];   /* Vendor Identification */
-   u8  product_id[16]; /* Product Identification */
-   u8  revision_level[4];  /* Revision Level */
-   u8  vendor_specific[20];/* Vendor Specific - Optional */
-   u8  reserved56t95[40];  /* Reserved - Optional */
-   /* Additional information may 
be returned */
-} idefloppy_inquiry_result_t;
-
-/*
  * REQUEST SENSE packet command result - Data Format.
  */
 typedef struct {
-- 
1.5.3.7

-
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/21] ide-floppy: replace ntoh{s,l} and hton{s,l} calls with the generic byteorder

2008-01-11 Thread Borislav Petkov
Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
---
 drivers/ide/ide-floppy.c |   28 ++--
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index e4ebb21..e63758a 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -1060,8 +1060,8 @@ static void idefloppy_create_format_unit_cmd 
(idefloppy_pc_t *pc, int b, int l,
pc->buffer[1] ^= 0x20;  /* ... turn off DCRT bit */
pc->buffer[3] = 8;
 
-   put_unaligned(htonl(b), (unsigned int *)(&pc->buffer[4]));
-   put_unaligned(htonl(l), (unsigned int *)(&pc->buffer[8]));
+   put_unaligned(cpu_to_be32(b), (unsigned int *)(&pc->buffer[4]));
+   put_unaligned(cpu_to_be32(l), (unsigned int *)(&pc->buffer[8]));
pc->buffer_size=12;
set_bit(PC_WRITING, &pc->flags);
 }
@@ -1089,7 +1089,7 @@ static void idefloppy_create_mode_sense_cmd 
(idefloppy_pc_t *pc, u8 page_code, u
printk(KERN_ERR "ide-floppy: unsupported page code "
"in create_mode_sense_cmd\n");
}
-   put_unaligned(htons(length), (u16 *) &pc->c[7]);
+   put_unaligned(cpu_to_be16(length), (u16 *) &pc->c[7]);
pc->request_transfer = length;
 }
 
@@ -1119,12 +1119,12 @@ static void idefloppy_create_rw_cmd (idefloppy_floppy_t 
*floppy, idefloppy_pc_t
idefloppy_init_pc(pc);
if (test_bit(IDEFLOPPY_USE_READ12, &floppy->flags)) {
pc->c[0] = cmd == READ ? GPCMD_READ_12 : GPCMD_WRITE_12;
-   put_unaligned(htonl(blocks), (unsigned int *) &pc->c[6]);
+   put_unaligned(cpu_to_be32(blocks), (unsigned int *) &pc->c[6]);
} else {
pc->c[0] = cmd == READ ? GPCMD_READ_10 : GPCMD_WRITE_10;
-   put_unaligned(htons(blocks), (unsigned short *) &pc->c[7]);
+   put_unaligned(cpu_to_be16(blocks), (unsigned short *)&pc->c[7]);
}
-   put_unaligned(htonl(block), (unsigned int *) &pc->c[2]);
+   put_unaligned(cpu_to_be32(block), (unsigned int *) &pc->c[2]);
pc->callback = &idefloppy_rw_callback;
pc->rq = rq;
pc->b_count = cmd == READ ? 0 : rq->bio->bi_size;
@@ -1252,10 +1252,10 @@ static int idefloppy_get_flexible_disk_page 
(ide_drive_t *drive)
set_disk_ro(floppy->disk, floppy->wp);
page = (idefloppy_flexible_disk_page_t *) (header + 1);
 
-   page->transfer_rate = ntohs(page->transfer_rate);
-   page->sector_size = ntohs(page->sector_size);
-   page->cyls = ntohs(page->cyls);
-   page->rpm = ntohs(page->rpm);
+   page->transfer_rate = be16_to_cpu(page->transfer_rate);
+   page->sector_size = be16_to_cpu(page->sector_size);
+   page->cyls = be16_to_cpu(page->cyls);
+   page->rpm = be16_to_cpu(page->rpm);
capacity = page->cyls * page->heads * page->sectors * page->sector_size;
if (memcmp (page, &floppy->flexible_disk_page, sizeof 
(idefloppy_flexible_disk_page_t)))
printk(KERN_INFO "%s: %dkB, %d/%d/%d CHS, %d kBps, "
@@ -1328,8 +1328,8 @@ static int idefloppy_get_capacity (ide_drive_t *drive)
descriptor = (idefloppy_capacity_descriptor_t *) (header + 1);
 
for (i = 0; i < descriptors; i++, descriptor++) {
-   blocks = descriptor->blocks = ntohl(descriptor->blocks);
-   length = descriptor->length = ntohs(descriptor->length);
+   blocks = descriptor->blocks = be32_to_cpu(descriptor->blocks);
+   length = descriptor->length = be16_to_cpu(descriptor->length);
 
if (!i) 
{
@@ -1456,8 +1456,8 @@ static int idefloppy_get_format_capacities(ide_drive_t 
*drive, int __user *arg)
if (i == 0)
continue;   /* Skip the first descriptor */
 
-   blocks = ntohl(descriptor->blocks);
-   length = ntohs(descriptor->length);
+   blocks = be32_to_cpu(descriptor->blocks);
+   length = be16_to_cpu(descriptor->length);
 
if (put_user(blocks, argp))
return(-EFAULT);
-- 
1.5.3.7

-
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 04/21] ide-floppy: cleanup and unify debugging macro calls

2008-01-11 Thread Borislav Petkov
* some debug_log() calls were not using "ide-floppy: " prefix

* a few used printk levels different than KERN_INFO (KERN_NOTICE
  and KERN_ERR, which is the default one if no level is given)

There should be no functional change resulting from this patch.

Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
---
 drivers/ide/ide-floppy.c |   66 +-
 1 files changed, 30 insertions(+), 36 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 66dfd18..e8fe8ef 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -58,7 +58,8 @@
 #define IDEFLOPPY_DEBUG( fmt, args... )
 
 #if IDEFLOPPY_DEBUG_LOG
-#define debug_log printk
+#define debug_log(fmt, args...) \
+   printk(KERN_INFO "ide-floppy: " fmt, ## args)
 #else
 #define debug_log(fmt, args... ) do {} while(0)
 #endif
@@ -478,7 +479,7 @@ static int idefloppy_do_end_request(ide_drive_t *drive, int 
uptodate, int nsecs)
struct request *rq = HWGROUP(drive)->rq;
int error;
 
-   debug_log(KERN_INFO "Reached idefloppy_end_request\n");
+   debug_log("Reached %s\n", __FUNCTION__);
 
switch (uptodate) {
case 0: error = IDEFLOPPY_ERROR_GENERAL; break;
@@ -624,21 +625,20 @@ static void idefloppy_analyze_error (ide_drive_t 
*drive,idefloppy_request_sense_
floppy->progress_indication = result->sksv[0] & 0x80 ?
(u16)get_unaligned((u16 *)(result->sksv+1)):0x1;
if (floppy->failed_pc)
-   debug_log(KERN_INFO "ide-floppy: pc = %x, sense key = %x, "
-   "asc = %x, ascq = %x\n", floppy->failed_pc->c[0],
-   result->sense_key, result->asc, result->ascq);
+   debug_log("pc = %x, sense key = %x, asc = %x, ascq = %x\n",
+   floppy->failed_pc->c[0], result->sense_key,
+   result->asc, result->ascq);
else
-   debug_log(KERN_INFO "ide-floppy: sense key = %x, asc = %x, "
-   "ascq = %x\n", result->sense_key,
-   result->asc, result->ascq);
+   debug_log("sense key = %x, asc = %x, ascq = %x\n",
+   result->sense_key, result->asc, result->ascq);
 }
 
 static void idefloppy_request_sense_callback (ide_drive_t *drive)
 {
idefloppy_floppy_t *floppy = drive->driver_data;
 
-   debug_log(KERN_INFO "ide-floppy: Reached %s\n", __FUNCTION__);
-   
+   debug_log("Reached %s\n", __FUNCTION__);
+
if (!floppy->pc->error) {
idefloppy_analyze_error(drive,(idefloppy_request_sense_result_t 
*) floppy->pc->buffer);
idefloppy_do_end_request(drive, 1, 0);
@@ -654,8 +654,8 @@ static void idefloppy_request_sense_callback (ide_drive_t 
*drive)
 static void idefloppy_pc_callback (ide_drive_t *drive)
 {
idefloppy_floppy_t *floppy = drive->driver_data;
-   
-   debug_log(KERN_INFO "ide-floppy: Reached %s\n", __FUNCTION__);
+
+   debug_log("Reached %s\n", __FUNCTION__);
 
idefloppy_do_end_request(drive, floppy->pc->error ? 0 : 1, 0);
 }
@@ -714,8 +714,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t 
*drive)
u16 bcount;
u8 stat, ireason;
 
-   debug_log(KERN_INFO "ide-floppy: Reached %s interrupt handler\n",
-   __FUNCTION__);
+   debug_log("Reached %s interrupt handler\n", __FUNCTION__);
 
if (test_bit(PC_DMA_IN_PROGRESS, &pc->flags)) {
if (HWIF(drive)->ide_dma_end(drive)) {
@@ -724,23 +723,22 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t 
*drive)
pc->actually_transferred = pc->request_transfer;
idefloppy_update_buffers(drive, pc);
}
-   debug_log(KERN_INFO "ide-floppy: DMA finished\n");
+   debug_log("DMA finished\n");
}
 
/* Clear the interrupt */
stat = drive->hwif->INB(IDE_STATUS_REG);
 
if ((stat & DRQ_STAT) == 0) {   /* No more interrupts */
-   debug_log(KERN_INFO "Packet command completed, %d bytes "
-   "transferred\n", pc->actually_transferred);
+   debug_log("Packet command completed, %d bytes transferred\n",
+   pc->actually_transferred);
clear_bit(PC_DMA_IN_PROGRESS, &pc->flags);
 
local_irq_enable_in_hardirq();
 
if ((stat & ERR_STAT) || test_bit(PC_DMA_ERROR, &pc->flags)) {
/* Error detected */
-   debug_log(KERN_INFO "ide-floppy: %s: I/O error\n",
-   drive->name);
+   debug_log("I/O error\n", drive->name);
rq->errors++;
if (pc->c[0] == GPCMD_REQUEST_SENSE) {
printk(KERN_ERR "ide-floppy: I/O error in "
@@ -801,9 +799,8 @@ static id

[PATCH 00/21] ide-floppy redux v2

2008-01-11 Thread Borislav Petkov

Hi Bart,

   here's the second version of the ide-floppy refactoring trail. All the
patches are based on the version of your quilt tree from the 05.01. Also, you've
already applied patch 5 in this series but i'm submitting it still for the sake
of completeness.


 drivers/ide/ide-cd.c |2 -
 drivers/ide/ide-floppy.c | 1403 ++
 include/linux/cdrom.h|1 +
 include/linux/ide.h  |3 +
 4 files changed, 558 insertions(+), 851 deletions(-)

p.s. Next stop: ide-tape.c :)
-
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 16/21] ide-floppy: use an xfer_func_t and io_buf_t typedefs in order to unify rw

2008-01-11 Thread Borislav Petkov
Also, move xfer_func_t typedef to the ide.h since it is used by two drivers
now (more coming).

Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
---
 drivers/ide/ide-cd.c |2 --
 drivers/ide/ide-floppy.c |   37 ++---
 include/linux/ide.h  |3 +++
 3 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 3b3e6c1..7e53a03 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -604,8 +604,6 @@ static ide_startstop_t cdrom_transfer_packet_command 
(ide_drive_t *drive,
  * Block read functions.
  */
 
-typedef void (xfer_func_t)(ide_drive_t *, void *, u32);
-
 static void ide_cd_pad_transfer(ide_drive_t *drive, xfer_func_t *xf, int len)
 {
while (len > 0) {
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 6e8926a..c889c16 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -491,19 +491,22 @@ static void idefloppy_retry_pc(ide_drive_t *drive)
idefloppy_queue_pc_head(drive, pc, rq);
 }
 
-/*
- * The usual interrupt handler called during a packet command.
- */
+typedef void (io_buf_t)(ide_drive_t *, idefloppy_pc_t *, unsigned int);
+
+/*  The usual interrupt handler called during a packet command. */
 static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
 {
idefloppy_floppy_t *floppy = drive->driver_data;
ide_hwif_t *hwif = drive->hwif;
idefloppy_pc_t *pc = floppy->pc;
struct request *rq = pc->rq;
+   xfer_func_t *xferfunc;
+   io_buf_t *iobuf_func;
unsigned int temp;
u16 bcount;
u8 stat, ireason;
int dma_error = 0;
+   int write = (rq_data_dir(rq) == WRITE) ? 1 : 0;
 
debug_log("Reached %s interrupt handler\n", __FUNCTION__);
 
@@ -511,9 +514,7 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
dma_error = HWIF(drive)->ide_dma_end(drive);
if (dma_error) {
printk(KERN_ERR "%s: DMA %s error\n", drive->name,
-   rq_data_dir(rq) == WRITE ?
-   "write" :
-   "read");
+   write ? "write" : "read");
set_bit(PC_DMA_ERROR, &pc->flags);
} else {
pc->actually_transferred = pc->request_transfer;
@@ -568,7 +569,7 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
ireason = hwif->INB(IDE_IREASON_REG);
 
if (ireason & CD) {
-   printk(KERN_ERR "ide-floppy: CoD != 0 in idefloppy_pc_intr\n");
+   printk(KERN_ERR "ide-floppy: CoD != 0 in %s\n", __FUNCTION__);
return ide_do_reset(drive);
}
if (((ireason & IO) == IO) == test_bit(PC_WRITING, &pc->flags)) {
@@ -600,20 +601,18 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t 
*drive)
}
}
if (test_bit(PC_WRITING, &pc->flags)) {
-   if (pc->buffer != NULL)
-   /* Write the current buffer */
-   hwif->atapi_output_bytes(drive, pc->current_position,
-bcount);
-   else
-   idefloppy_output_buffers(drive, pc, bcount);
+   xferfunc = hwif->atapi_output_bytes;
+   iobuf_func = &idefloppy_output_buffers;
} else {
-   if (pc->buffer != NULL)
-   /* Read the current buffer */
-   hwif->atapi_input_bytes(drive, pc->current_position,
-   bcount);
-   else
-   idefloppy_input_buffers(drive, pc, bcount);
+   xferfunc = hwif->atapi_input_bytes;
+   iobuf_func = &idefloppy_input_buffers;
}
+
+   if (pc->buffer != NULL)
+   xferfunc(drive, pc->current_position, bcount);
+   else
+   iobuf_func(drive, pc, bcount);
+
/* Update the current position */
pc->actually_transferred += bcount;
pc->current_position += bcount;
diff --git a/include/linux/ide.h b/include/linux/ide.h
index bfbc975..a6cf280 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -626,6 +626,9 @@ typedef struct hwif_s {
 typedef ide_startstop_t (ide_handler_t)(ide_drive_t *);
 typedef int (ide_expiry_t)(ide_drive_t *);
 
+/* used by ide-cd, ide-floppy, etc. */
+typedef void (xfer_func_t)(ide_drive_t *, void *, u32);
+
 typedef struct hwgroup_s {
/* irq handler, if active */
ide_startstop_t (*handler)(ide_drive_t *);
-- 
1.5.3.7

-
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


buffer_head list oops with new PATA driver: help request

2008-01-11 Thread James Chapman
I'm seeking help for a problem we're having with a new PATA driver for a
Toshiba TX4939 MIPS SoC.

The driver works fine for most use cases, but we get an oops when stress
testing with bonnie++. The oops is always a null pointer while walking a
buffer_head list (b_this_page is null) when bonnie++ reads back its
data. This only happens when DMA is enabled, and only when bonnie++
parameters are chosen to stress memory usage such that buffers are
recycled by the kernel. The oops still happens if the CPU cache is
disabled or if bonnie++'s -b option is specified to force a sync() on
every write.

Below is the most common oops trace. I'm wondering if this can be caused
by a bug in the driver or if there is a platform-specific issue? I can
post the driver source here if it would be useful.

Kernel: 2.6.22 (also happens with 2.6.23)
Arch: mips
RAM: 256M

# bonnie++ -d bench -s 512 -n 1 -x 1 -u root -r 256 -f
Writing intelligently...done
Rewriting...Unhandled kernel unaligned access[#1]:
Cpu 0
$ 0   :  fffd  
$ 4   :   01010101 8463d4d0
$ 8   : 81118880 81118860  8f0d6884
$12   : 0001 0008 0001 8f0d6884
$16   : 81118880   8f0d67b8
$20   : 812d1f08  0001 842c9700
$24   : 0001 000e
$28   : 812d 812d1c48 000c 8016e1f8
Hi: 
Lo: 0005
epc   : 801d88d4 __mpage_writepage+0xc0/0x8e8 Not tainted
ra: 8016e1f8 write_cache_pages+0x35c/0x4fc
Status: 10008403KERNEL EXL IE
Cause : 1010
BadVA : 01010101
PrId  : 2d40
Modules linked in: pata_tx49xx
Process pdflush (pid: 76, threadinfo=812d, task=812fa900)
Stack : 0060 801334b4  81a9c930 0020 0070 00446d85

8fe07600  8030b5ec 812d1f08 031a 802ff96c 
fffd
842c9100 842c9100 0060  0008  8f1342d0
8fdd0c90
0060 0060  802fb94c 0968  000e
8f0d6880
 812d1d58 8f0d6890 812d1d90 80165dd4 0001 8f0d6880

...
Call Trace:
[<801d88d4>] __mpage_writepage+0xc0/0x8e8
[<8016e1f8>] write_cache_pages+0x35c/0x4fc
[<801d9140>] mpage_writepages+0x44/0xa8
[<8016e438>] do_writepages+0x74/0x7c
[<801c3528>] __writeback_single_inode+0xb4/0x47c
[<801c3fa0>] sync_sb_inodes+0x208/0x33c
[<801c4420>] writeback_inodes+0x11c/0x13c
[<8016ce98>] background_writeout+0xcc/0x120
[<8016efc0>] pdflush+0x1e0/0x2d0
[<80147820>] kthread+0x88/0xc4
[<80105ee4>] kernel_thread_helper+0x10/0x18


Code: 9021  8d07000c  00e03021 <8cc2> 00021082  30420001
00028036  8cc



-- 
James Chapman
Katalix Systems Ltd
http://www.katalix.com
Catalysts for your Embedded Linux software development


-
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 14/21] ide-floppy: mv idefloppy_{should_,}report_error

2008-01-11 Thread Borislav Petkov
In addition to shortening the function name, move the printk-call into the
function thereby saving some code lines. Also, make the function out_of_line
since it is not on a performance critical path.

Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
---
 drivers/ide/ide-floppy.c |   37 ++---
 1 files changed, 14 insertions(+), 23 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 49d83a1..b718615 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -707,16 +707,18 @@ static ide_startstop_t idefloppy_transfer_pc1(ide_drive_t 
*drive)
return ide_started;
 }
 
-/*
- * Suppresses error messages resulting from Medium not present.
- */
-static inline int idefloppy_should_report_error(idefloppy_floppy_t *floppy)
+static void idefloppy_report_error(idefloppy_floppy_t *floppy,
+   idefloppy_pc_t *pc)
 {
if (floppy->sense_key == 0x02 &&
floppy->asc   == 0x3a &&
floppy->ascq  == 0x00)
-   return 0;
-   return 1;
+   return;
+
+   printk(KERN_ERR "ide-floppy: %s: I/O error, pc = %2x, key = %2x, "
+   "asc = %2x, ascq = %2x\n",
+   floppy->drive->name, pc->c[0], floppy->sense_key,
+   floppy->asc, floppy->ascq);
 }
 
 static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive,
@@ -741,15 +743,8 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t 
*drive,
 *  a legitimate error code was received.
 */
if (!test_bit(PC_ABORT, &pc->flags)) {
-   if (!test_bit(PC_SUPPRESS_ERROR, &pc->flags)) {
-   if (idefloppy_should_report_error(floppy))
-   printk(KERN_ERR "ide-floppy: %s: I/O 
error, "
-  "pc = %2x, key = %2x, "
-  "asc = %2x, ascq = %2x\n",
-  drive->name, pc->c[0],
-  floppy->sense_key,
-  floppy->asc, floppy->ascq);
-   }
+   if (!test_bit(PC_SUPPRESS_ERROR, &pc->flags))
+   idefloppy_report_error(floppy, pc);
/* Giving up */
pc->error = IDEFLOPPY_ERROR_GENERAL;
}
@@ -958,16 +953,12 @@ static ide_startstop_t idefloppy_do_request(ide_drive_t 
*drive,
rq->nr_sectors, rq->current_nr_sectors);
 
if (rq->errors >= ERROR_MAX) {
-   if (floppy->failed_pc != NULL) {
-   if (idefloppy_should_report_error(floppy))
-   printk(KERN_ERR "ide-floppy: %s: I/O error, pc 
= %2x,"
-  " key = %2x, asc = %2x, ascq = %2x\n",
-  drive->name, floppy->failed_pc->c[0],
-  floppy->sense_key, floppy->asc, 
floppy->ascq);
-   }
+   if (floppy->failed_pc != NULL)
+   idefloppy_report_error(floppy, floppy->failed_pc);
else
printk(KERN_ERR "ide-floppy: %s: I/O error\n",
-   drive->name);
+   drive->name);
+
idefloppy_do_end_request(drive, 0, 0);
return ide_stopped;
}
-- 
1.5.3.7

-
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/21] ide-floppy: remove unnecessary ->handler != NULL check

2008-01-11 Thread Borislav Petkov
This BUG_ON is unneeded since the ->handler != NULL check is performed in
ide_set_handler().

Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
---
 drivers/ide/ide-floppy.c |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index e63758a..66dfd18 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -794,7 +794,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t 
*drive)
"to send us more data than expected "
"- discarding data\n");
idefloppy_discard_data(drive, bcount);
-   BUG_ON(HWGROUP(drive)->handler != NULL);
+
ide_set_handler(drive,
&idefloppy_pc_intr,
IDEFLOPPY_WAIT_CMD,
@@ -825,7 +825,6 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t 
*drive)
pc->actually_transferred += bcount;
pc->current_position += bcount;
 
-   BUG_ON(HWGROUP(drive)->handler != NULL);
ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL);   
/* And set the interrupt handler again */
return ide_started;
 }
@@ -852,7 +851,7 @@ static ide_startstop_t idefloppy_transfer_pc (ide_drive_t 
*drive)
"issuing a packet command\n");
return ide_do_reset(drive);
}
-   BUG_ON(HWGROUP(drive)->handler != NULL);
+
/* Set the interrupt routine */
ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL);
/* Send the actual packet */
@@ -908,7 +907,7 @@ static ide_startstop_t idefloppy_transfer_pc1 (ide_drive_t 
*drive)
 * 40 and 50msec work well. idefloppy_pc_intr will not be actually
 * used until after the packet is moved in about 50 msec.
 */
-   BUG_ON(HWGROUP(drive)->handler != NULL);
+
ide_set_handler(drive, 
  &idefloppy_pc_intr,   /* service routine for packet command */
  floppy->ticks,/* wait this long before "failing" */
-- 
1.5.3.7

-
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 17/21] ide-floppy: include the proper headers

2008-01-11 Thread Borislav Petkov
Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
---
 drivers/ide/ide-floppy.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index c889c16..89b26ea 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -37,9 +37,9 @@
 #include 
 
 #include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
 #include 
 
 /* The following are used to debug the driver. */
-- 
1.5.3.7

-
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: sata_nv does not function in kernel > 2.6.20.21

2008-01-11 Thread Alan Cox
> Error -16 is EBUSY, which causes the driver load to fail due to the 
> "Unable to reserve mem region" message.
> 
> This means that the sata_nv driver needed to use PCI BAR 6, but was 
> unable to for some reason.  Given that sata_nv uses devres like other 
> libata drivers, IMO the likely cause is outside the ATA subsystem (PCI? 
> ACPI?).

Actually it looks to me like there is something very odd going on here.
The sata_nv code checks each of the 6 resources exists (wrongly - it does
it before pcim_enable_device so the check is probably not valid). That
would report -ENODEV.

EBUSY implies all 6 resources were assigned but one couldn't be mapped.
-
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


SATA CDDVDRW and kernel 2.6.23.12 problems

2008-01-11 Thread Paul Surgeon
I keep getting the following error messages during bootup with kernel
2.6.23.12 :

scsi 4:0:0:0: CD-ROMTSSTcorp CDDVDW TS-L633A  UO00 PQ: 0 ANSI: 5
ata3.00: qc timeout (cmd 0xa0)
ata3.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x2 frozen
ata3.00: (irq_stat 0x4001)
ata3.00: cmd a0/00:00:00:00:20/00:00:00:00:00/a0 tag 0 cdb 0x0 data 0
 res 51/60:03:00:00:00/00:00:00:00:00/a0 Emask 0x5 (timeout)
ata3: soft resetting port
ata3: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
ata3.00: configured for PIO4
ata3: EH complete

The error repeats many times and it takes about 10 minutes for the box to boot.
If I unplug the DVD drive the problem naturally disappears.
The machine is an Intel SR1530SH.

Below is the output from lspci :
00:00.0 Host bridge: Intel Corporation Server DRAM Controller
00:01.0 PCI bridge: Intel Corporation Server Host-Primary PCI Express Bridge
00:19.0 Ethernet controller: Intel Corporation 82566DM-2 Gigabit
Network Connection (rev 02)
00:1c.0 PCI bridge: Intel Corporation PCI Express Port 1 (rev 02)
00:1c.4 PCI bridge: Intel Corporation PCI Express Port 5 (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 92)
00:1f.0 ISA bridge: Intel Corporation LPC Interface Controller (rev 02)
00:1f.2 SATA controller: Intel Corporation 6 port SATA AHCI Controller (rev 02)
00:1f.3 SMBus: Intel Corporation SMBus Controller (rev 02)
01:00.0 Ethernet controller: Intel Corporation 82571EB Gigabit
Ethernet Controller (rev 06)
01:00.1 Ethernet controller: Intel Corporation 82571EB Gigabit
Ethernet Controller (rev 06)
03:00.0 VGA compatible controller: Matrox Graphics, Inc. MGA G200e
[Pilot] ServerEngines (SEP1) (rev 02)
04:02.0 Ethernet controller: Intel Corporation 82541GI Gigabit
Ethernet Controller (rev 05)

I've tried switching acpi off, using irqpoll, switching from AHCI to
RAID in the BIOS but it makes no difference at all.
I also tried kernel 2.6.21.5 (Slackware 12.0) and the problem is still there.
Any ideas?

Thanks
Paul
-
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


[Bug 9728] Serverworks initialisation fails

2008-01-11 Thread bugme-daemon
http://bugzilla.kernel.org/show_bug.cgi?id=9728


[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|RESOLVED|VERIFIED




-- 
Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.
-
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


[Bug 9728] Serverworks initialisation fails

2008-01-11 Thread bugme-daemon
http://bugzilla.kernel.org/show_bug.cgi?id=9728


[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||CODE_FIX




-- 
Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.
-
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


[Bug 9728] Serverworks initialisation fails

2008-01-11 Thread bugme-daemon
http://bugzilla.kernel.org/show_bug.cgi?id=9728





--- Comment #1 from [EMAIL PROTECTED]  2008-01-11 07:40 ---
Created an attachment (id=14413)
 --> (http://bugzilla.kernel.org/attachment.cgi?id=14413&action=view)
Looks like an unterminated DMI table...

The following patch, which terminates the ide_acpi_dmi_table appears to
fix the problem.
Credit goes to Jeff Garzik...


-- 
Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.
-
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: 40-wire cable detected when directly connected

2008-01-11 Thread Alan Cox
> I don't know very well about CF but does it even fill UDMA/33?  What
> does 'dd if=/dev/sdc of=/dev/null bs=1M count=16 iflag=direct' say?  You
> can increase count for more reliable result.

Some CF hardware can manage UDMA33, almost no adapters and cable
convertors can however. I don't know if any of the 40pin CF connectors
are rated for over UDMA33 (but they are 40 wire so that is correct ;))

Alan
-
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 21/21] ide-floppy: remove atomic test_*bit macros

2008-01-11 Thread Borislav Petkov
This change is temporary and after unification of the IDE subsystem proper
bit setting and testing macros will be introduced.

Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
---
 drivers/ide/ide-floppy.c |   82 +-
 1 files changed, 45 insertions(+), 37 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 4106eb4..29c1983 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -479,12 +479,12 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t 
*drive)
 
debug_log("Reached %s interrupt handler\n", __FUNCTION__);
 
-   if (test_bit(PC_DMA_IN_PROGRESS, &pc->flags)) {
+   if ((1UL << PC_DMA_IN_PROGRESS) & pc->flags) {
dma_error = HWIF(drive)->ide_dma_end(drive);
if (dma_error) {
printk(KERN_ERR "%s: DMA %s error\n", drive->name,
write ? "write" : "read");
-   set_bit(PC_DMA_ERROR, &pc->flags);
+   pc->flags |= (1UL << PC_DMA_ERROR);
} else {
pc->actually_transferred = pc->request_transfer;
idefloppy_update_buffers(drive, pc);
@@ -499,11 +499,11 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t 
*drive)
/* No more interrupts */
debug_log("Packet command completed, %d bytes transferred\n",
pc->actually_transferred);
-   clear_bit(PC_DMA_IN_PROGRESS, &pc->flags);
+   pc->flags &= ((1UL << PC_DMA_IN_PROGRESS) ^ ~0UL);
 
local_irq_enable_in_hardirq();
 
-   if ((stat & ERR_STAT) || test_bit(PC_DMA_ERROR, &pc->flags)) {
+   if ((stat & ERR_STAT) || ((1UL << PC_DMA_ERROR) & pc->flags)) {
/* Error detected */
debug_log("I/O error\n", drive->name);
rq->errors++;
@@ -525,7 +525,8 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
return ide_stopped;
}
 
-   if (test_and_clear_bit(PC_DMA_IN_PROGRESS, &pc->flags)) {
+   if ((1UL << PC_DMA_IN_PROGRESS) & pc->flags) {
+   pc->flags &= ((1UL << PC_DMA_IN_PROGRESS) ^ ~0UL);
printk(KERN_ERR "ide-floppy: The floppy wants to issue "
"more interrupts in DMA mode\n");
ide_dma_off(drive);
@@ -704,13 +705,13 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t 
*drive,
floppy->pc = pc;
 
if (pc->retries > IDEFLOPPY_MAX_PC_RETRIES ||
-   test_bit(PC_ABORT, &pc->flags)) {
+   ((1UL << PC_ABORT) & pc->flags)) {
/*
 *  We will "abort" retrying a packet command in case
 *  a legitimate error code was received.
 */
-   if (!test_bit(PC_ABORT, &pc->flags)) {
-   if (!test_bit(PC_SUPPRESS_ERROR, &pc->flags))
+   if (!((1UL << PC_ABORT) & pc->flags)) {
+   if (!((1UL << PC_SUPPRESS_ERROR) & pc->flags))
idefloppy_report_error(floppy, pc);
/* Giving up */
pc->error = IDEFLOPPY_ERROR_GENERAL;
@@ -728,12 +729,14 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t 
*drive,
pc->current_position = pc->buffer;
bcount = min(pc->request_transfer, 63 * 1024);
 
-   if (test_and_clear_bit(PC_DMA_ERROR, &pc->flags))
+   if ((1UL << PC_DMA_ERROR) & pc->flags) {
+   pc->flags &= ((1UL << PC_DMA_ERROR) ^ ~0UL);
ide_dma_off(drive);
+   }
 
dma = 0;
 
-   if (test_bit(PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma)
+   if (((1UL << PC_DMA_RECOMMENDED) & pc->flags) && drive->using_dma)
dma = !hwif->dma_setup(drive);
 
ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK |
@@ -741,12 +744,12 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t 
*drive,
 
if (dma) {
/* Begin DMA, if necessary */
-   set_bit(PC_DMA_IN_PROGRESS, &pc->flags);
+   pc->flags |= 1UL << PC_DMA_IN_PROGRESS;
hwif->dma_start(drive);
}
 
/* Can we transfer the packet when we get the interrupt or wait? */
-   if (test_bit(IDEFLOPPY_ZIP_DRIVE, &floppy->flags)) {
+   if ((1UL << IDEFLOPPY_ZIP_DRIVE) & floppy->flags) {
/* wait */
pkt_xfer_routine = &idefloppy_transfer_pc1;
} else {
@@ -754,7 +757,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t 
*drive,
pkt_xfer_routine = &idefloppy_transfer_pc;
}
 
-   if (test_bit(IDEFLOPPY_DRQ_INTERRUPT, &floppy->flags)) {
+   if ((1UL << IDEFLOPPY_DRQ_INTERRUPT) & floppy->flags) {
/* Issue the packet command */
ide_execu

[PATCH 11/21] ide-floppy: fix comments formatting

2008-01-11 Thread Borislav Petkov
That is,
- remove unnecessary comments
- shorten comments
- shorten lines longer 80 columns
- cleanup whitespace
- add a missing loglevel KERN_ to a printk-call
- fix misc checkpatch warnings

Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
---
 drivers/ide/ide-floppy.c |  402 +-
 1 files changed, 181 insertions(+), 221 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 11c2c9b..5d612e7 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -4,11 +4,6 @@
  * Copyright (C) 1996-1999  Gadi Oxman <[EMAIL PROTECTED]>
  * Copyright (C) 2000-2002  Paul Bristow <[EMAIL PROTECTED]>
  * Copyright (C) 2005   Bartlomiej Zolnierkiewicz
- */
-
-/*
- * The driver currently doesn't have any fancy features, just the bare
- * minimum read/write support.
  *
  * This driver supports the following IDE floppy drives:
  *
@@ -47,14 +42,11 @@
 #include 
 #include 
 
-/*
- * The following are used to debug the driver.
- */
+/* The following are used to debug the driver. */
 #define IDEFLOPPY_DEBUG_LOG0
 #define IDEFLOPPY_DEBUG_INFO   0
 #define IDEFLOPPY_DEBUG_BUGS   1
 
-/* #define IDEFLOPPY_DEBUG(fmt, args...) printk(KERN_INFO fmt, ## args) */
 #define IDEFLOPPY_DEBUG( fmt, args... )
 
 #if IDEFLOPPY_DEBUG_LOG
@@ -65,59 +57,56 @@
 #endif
 
 
-/*
- * Some drives require a longer irq timeout.
- */
+/* Some drives require a longer irq timeout. */
 #define IDEFLOPPY_WAIT_CMD (5 * WAIT_CMD)
 
 /*
- * After each failed packet command we issue a request sense command
- * and retry the packet command IDEFLOPPY_MAX_PC_RETRIES times.
+ * After each failed packet command we issue a request sense command and retry
+ * the packet command IDEFLOPPY_MAX_PC_RETRIES times.
  */
 #define IDEFLOPPY_MAX_PC_RETRIES   3
 
 /*
- * With each packet command, we allocate a buffer of
- * IDEFLOPPY_PC_BUFFER_SIZE bytes.
+ * With each packet command, we allocate a buffer of
+ * IDEFLOPPY_PC_BUFFER_SIZE bytes.
  */
 #define IDEFLOPPY_PC_BUFFER_SIZE   256
 
 /*
- * In various places in the driver, we need to allocate storage
- * for packet commands and requests, which will remain valid while
- * we leave the driver to wait for an interrupt or a timeout event.
+ * In various places in the driver, we need to allocate storage for packet
+ * commands and requests, which will remain valid while we leave the driver to
+ * wait for an interrupt or a timeout event.
  */
 #define IDEFLOPPY_PC_STACK (10 + IDEFLOPPY_MAX_PC_RETRIES)
 
-/*
- * Our view of a packet command.
- */
 typedef struct idefloppy_packet_command_s {
u8 c[12];   /* Actual packet bytes */
-   int retries;/* On each retry, we increment 
retries */
+   int retries;/* On each retry, we increment
+  retries */
int error;  /* Error code */
int request_transfer;   /* Bytes to transfer */
int actually_transferred;   /* Bytes actually transferred */
int buffer_size;/* Size of our data buffer */
-   int b_count;/* Missing/Available data on 
the current buffer */
+   int b_count;/* Missing/Available data on
+  the current buffer */
struct request *rq; /* The corresponding request */
u8 *buffer; /* Data buffer */
-   u8 *current_position;   /* Pointer into the above 
buffer */
-   void (*callback) (ide_drive_t *);   /* Called when this packet 
command is completed */
+   u8 *current_position;   /* Pointer into above buffer */
+   void (*callback) (ide_drive_t *);   /* Called when this packet
+  command is completed */
u8 pc_buffer[IDEFLOPPY_PC_BUFFER_SIZE]; /* Temporary buffer */
-   unsigned long flags;/* Status/Action bit flags: 
long for set_bit */
+   unsigned long flags;/* Status/Action bit flags:
+  long for set_bit */
 } idefloppy_pc_t;
 
-/*
- * Packet command flag bits.
- */
-#definePC_ABORT0   /* Set when an error is 
considered normal - We won't retry */
-#define PC_DMA_RECOMMENDED 2   /* 1 when we prefer to use DMA 
if possible */
-#definePC_DMA_IN_PROGRESS  3   /* 1 while DMA in 
progress */
-#definePC_DMA_ERROR4   /* 1 when encountered 
problem during DMA */
-#definePC_WRITING  5   /* Data direction */
-
-#definePC_SU

[Bug 9728] Serverworks initialisation fails

2008-01-11 Thread bugme-daemon
http://bugzilla.kernel.org/show_bug.cgi?id=9728


[EMAIL PROTECTED] changed:

   What|Removed |Added

 CC||[EMAIL PROTECTED]
OtherBugsDependingO||9243
  nThis||




-- 
Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.
-
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 a bug of adma in rhel4u5 with HDS7250SASUN500G.

2008-01-11 Thread Robert Hancock

Kuan Luo wrote:

hi robert,
I have fixed a bug in rhel4u5 2.6.9-55 when running adma mode
with HDS7250SASUN500G.
Could you check this code and if no problem,  then help me to
submit to the newest kernel.


It seems like a reasonable change - I'm sure you guys would know better 
than I whether it's the right thing to do. The patch got newline wrapped 
and whitespace damaged, however. Can you repost (even as attachment) so 
people can try it out?




for 2.6.9-55
diff -Nupr a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
--- a/drivers/ata/sata_nv.c 2008-01-14 14:37:32.0 +0800
+++ b/drivers/ata/sata_nv.c 2008-01-14 14:37:21.0 +0800
@@ -802,7 +802,7 @@ static irqreturn_t nv_adma_interrupt(int
ata_port_printk(ap, KERN_ERR, "CPB
error, stat=0x%x\n", status);
have_global_err = 1;
}
-   if ((status & NV_ADMA_STAT_DONE) ||
have_global_err) {
+   if ((status & (NV_ADMA_STAT_CMD_COMPLETE |
NV_ADMA_STAT_DONE)) || have_global_err) {
/** Check CPBs for completed commands */
 
 if(ata_tag_valid(ap->active_tag))

@@ -814,6 +814,7 @@ static irqreturn_t nv_adma_interrupt(int
u32 active = ap->sactive;
while( (pos = ffs(active)) ) {
pos--;
+   if ((notifier_clears[i]
& (1 << pos)) || have_global_err)
nv_adma_check_cpb(ap,
pos, have_global_err ||
(notifier_error
& (1 << pos)) );
active &= ~(1 << pos );

for 2.6.24-rc7

diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index ed5dc7c..6bffd39 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -1010,8 +1010,7 @@ static irqreturn_t nv_adma_interrupt(int irq, void
*dev_instance)
continue;
}
 
-			if (status & (NV_ADMA_STAT_DONE |

- NV_ADMA_STAT_CPBERR)) {
+   if (status & (NV_ADMA_STAT_DONE |
NV_ADMA_STAT_CMD_COMPLETE | NV_ADMA_STAT_CPBERR)) {
u32 check_commands;
int pos, error = 0;
 
@@ -1023,8 +1022,8 @@ static irqreturn_t nv_adma_interrupt(int irq, void

*dev_instance)
/** Check CPBs for completed commands */
while ((pos = ffs(check_commands)) &&
!error) {
pos--;
-   error = nv_adma_check_cpb(ap,
pos,
-   notifier_error & (1 <<
pos));
+   if ((notifier_clears[i] & (1 <<
pos)) || (status & NV_ADMA_STAT_CPBERR))
+   error =
nv_adma_check_cpb(ap, pos, notifier_error & (1 << pos));
check_commands &= ~(1 << pos);
}
}
---
This email message is for the sole use of the intended recipient(s) and may 
contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact the 
sender by
reply email and destroy all copies of the original message.
---


-
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/21] ide-floppy: remove struct idefloppy_request_sense_result

2008-01-11 Thread Borislav Petkov
While at it, collapse idefloppy_analyze_error() into
idefloppy_request_sense_callback() since the latter was its only user.

Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
---
 drivers/ide/ide-floppy.c |   82 +
 1 files changed, 24 insertions(+), 58 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index d98264e..7d4ac0b 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -232,39 +232,6 @@ struct idefloppy_id_gcw {
 };
 
 /*
- * REQUEST SENSE packet command result - Data Format.
- */
-typedef struct {
-#if defined(__LITTLE_ENDIAN_BITFIELD)
-   unsignederror_code  :7; /* Current error (0x70) */
-   unsignedvalid   :1; /* The information field 
conforms to SFF-8070i */
-   u8  reserved1   :8; /* Reserved */
-   unsignedsense_key   :4; /* Sense Key */
-   unsignedreserved2_4 :1; /* Reserved */
-   unsignedili :1; /* Incorrect Length Indicator */
-   unsignedreserved2_67:2;
-#elif defined(__BIG_ENDIAN_BITFIELD)
-   unsignedvalid   :1; /* The information field 
conforms to SFF-8070i */
-   unsignederror_code  :7; /* Current error (0x70) */
-   u8  reserved1   :8; /* Reserved */
-   unsignedreserved2_67:2;
-   unsignedili :1; /* Incorrect Length Indicator */
-   unsignedreserved2_4 :1; /* Reserved */
-   unsignedsense_key   :4; /* Sense Key */
-#else
-#error "Bitfield endianness not defined! Check your byteorder.h"
-#endif
-   u32 information __attribute__ ((packed));
-   u8  asl;/* Additional sense length 
(n-7) */
-   u32 command_specific;   /* Additional command specific 
information */
-   u8  asc;/* Additional Sense Code */
-   u8  ascq;   /* Additional Sense Code 
Qualifier */
-   u8  replaceable_unit_code;  /* Field Replaceable Unit Code 
*/
-   u8  sksv[3];
-   u8  pad[2]; /* Padding to 20 bytes */
-} idefloppy_request_sense_result_t;
-
-/*
  * Pages of the SELECT SENSE / MODE SENSE packet commands.
  * See SFF-8070i spec.
  */
@@ -480,39 +447,38 @@ static struct request *idefloppy_next_rq_storage 
(ide_drive_t *drive)
return (&floppy->rq_stack[floppy->rq_stack_index++]);
 }
 
-/*
- * idefloppy_analyze_error is called on each failed packet command retry
- * to analyze the request sense.
- */
-static void idefloppy_analyze_error (ide_drive_t 
*drive,idefloppy_request_sense_result_t *result)
-{
-   idefloppy_floppy_t *floppy = drive->driver_data;
-
-   floppy->sense_key = result->sense_key;
-   floppy->asc = result->asc;
-   floppy->ascq = result->ascq;
-   floppy->progress_indication = result->sksv[0] & 0x80 ?
-   (u16)get_unaligned((u16 *)(result->sksv+1)):0x1;
-   if (floppy->failed_pc)
-   debug_log("pc = %x, sense key = %x, asc = %x, ascq = %x\n",
-   floppy->failed_pc->c[0], result->sense_key,
-   result->asc, result->ascq);
-   else
-   debug_log("sense key = %x, asc = %x, ascq = %x\n",
-   result->sense_key, result->asc, result->ascq);
-}
-
-static void idefloppy_request_sense_callback (ide_drive_t *drive)
+static void idefloppy_request_sense_callback(ide_drive_t *drive)
 {
idefloppy_floppy_t *floppy = drive->driver_data;
+   u8 *buf = floppy->pc->buffer;
 
debug_log("Reached %s\n", __FUNCTION__);
 
if (!floppy->pc->error) {
-   idefloppy_analyze_error(drive,(idefloppy_request_sense_result_t 
*) floppy->pc->buffer);
+   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->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_do_end_request(drive, 1, 0);
} else

[PATCH 20/21] ide-floppy: merge idefloppy_{input,output}_buffers

2008-01-11 Thread Borislav Petkov
We merge idefloppy_{input,output}_buffers() into idefloppy_io_buffers() by
introducing a 4th arg. called direction. According to its value
we atapi_input_bytes() or atapi_output_bytes(). Also, simplify the interrupt
handler by removing multiple calls testing the data direction and using a local
variable instead.

Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
---
 drivers/ide/ide-floppy.c |   67 +++--
 1 files changed, 17 insertions(+), 50 deletions(-)

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 3d9b1e5..4106eb4 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -295,42 +295,8 @@ static int idefloppy_do_end_request(ide_drive_t *drive, 
int uptodate, int nsecs)
return 0;
 }
 
-static void idefloppy_input_buffers(ide_drive_t *drive, idefloppy_pc_t *pc,
-   unsigned int bcount)
-{
-   struct request *rq = pc->rq;
-   struct bio_vec *bvec;
-   struct req_iterator iter;
-   unsigned long flags;
-   char *data;
-   int count, done = 0;
-
-   rq_for_each_segment(bvec, rq, iter) {
-   if (!bcount)
-   break;
-
-   count = min(bvec->bv_len, bcount);
-
-   data = bvec_kmap_irq(bvec, &flags);
-   drive->hwif->atapi_input_bytes(drive, data, count);
-   bvec_kunmap_irq(data, &flags);
-
-   bcount -= count;
-   pc->b_count += count;
-   done += count;
-   }
-
-   idefloppy_do_end_request(drive, 1, done >> 9);
-
-   if (bcount) {
-   printk(KERN_ERR "%s: leftover data in %s, bcount == %d\n",
-   drive->name, __FUNCTION__, bcount);
-   idefloppy_discard_data(drive, bcount);
-   }
-}
-
-static void idefloppy_output_buffers(ide_drive_t *drive, idefloppy_pc_t *pc,
-   unsigned int bcount)
+static void idefloppy_io_buffers(ide_drive_t *drive, idefloppy_pc_t *pc,
+   unsigned int bcount, int direction)
 {
struct request *rq = pc->rq;
struct req_iterator iter;
@@ -346,7 +312,10 @@ static void idefloppy_output_buffers(ide_drive_t *drive, 
idefloppy_pc_t *pc,
count = min(bvec->bv_len, bcount);
 
data = bvec_kmap_irq(bvec, &flags);
-   drive->hwif->atapi_output_bytes(drive, data, count);
+   if (direction)
+   drive->hwif->atapi_output_bytes(drive, data, count);
+   else
+   drive->hwif->atapi_input_bytes(drive, data, count);
bvec_kunmap_irq(data, &flags);
 
bcount -= count;
@@ -360,7 +329,10 @@ static void idefloppy_output_buffers(ide_drive_t *drive, 
idefloppy_pc_t *pc,
if (bcount) {
printk(KERN_ERR "%s: leftover data in %s, bcount == %d\n",
drive->name, __FUNCTION__, bcount);
-   idefloppy_write_zeros(drive, bcount);
+   if (direction)
+   idefloppy_write_zeros(drive, bcount);
+   else
+   idefloppy_discard_data(drive, bcount);
}
 #endif
 }
@@ -491,8 +463,6 @@ static void idefloppy_retry_pc(ide_drive_t *drive)
idefloppy_queue_pc_head(drive, pc, rq);
 }
 
-typedef void (io_buf_t)(ide_drive_t *, idefloppy_pc_t *, unsigned int);
-
 /*  The usual interrupt handler called during a packet command. */
 static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
 {
@@ -501,7 +471,6 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
idefloppy_pc_t *pc = floppy->pc;
struct request *rq = pc->rq;
xfer_func_t *xferfunc;
-   io_buf_t *iobuf_func;
unsigned int temp;
u16 bcount;
u8 stat, ireason;
@@ -573,7 +542,7 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
printk(KERN_ERR "ide-floppy: CoD != 0 in %s\n", __FUNCTION__);
return ide_do_reset(drive);
}
-   if (((ireason & IO) == IO) == test_bit(PC_WRITING, &pc->flags)) {
+   if (((ireason & IO) == IO) == write) {
/* Hopefully, we will never get here */
printk(KERN_ERR "ide-floppy: We wanted to %s, ",
(ireason & IO) ? "Write" : "Read");
@@ -581,7 +550,7 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
(ireason & IO) ? "Read" : "Write");
return ide_do_reset(drive);
}
-   if (!test_bit(PC_WRITING, &pc->flags)) {
+   if (!write) {
/* Reading - Check that we have enough space */
temp = pc->actually_transferred + bcount;
if (temp > pc->request_transfer) {
@@ -601,18 +570,16 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t 
*drive)
" expected - allowing transfer\n");
}
}
-

[Bug 9728] Serverworks initialisation fails

2008-01-11 Thread bugme-daemon
http://bugzilla.kernel.org/show_bug.cgi?id=9728


[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|VERIFIED|CLOSED




--- Comment #2 from [EMAIL PROTECTED]  2008-01-11 12:31 ---
Fix is now as commit 7c48c56e9b5a51263269dd419cc32531db141340 in Linus' tree.


-- 
Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.
-
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


Trouble with hdparm -d on Dell D610

2008-01-11 Thread Kristin Vadas Marsicano
Hello,

Please advise on how to enable DMA on my Dell D610 (any advice is much
appreciated!).  I tried hdparm –d1 /dev/hda, and I get the following
output:

"setting using_dma to 1 (on)
HDIO_SET_DMA failed: Operation not permitted
Using_dma = 0 (off)"

I'm running Linux kernel version 2.6.22.6 from kernels.org.   Below is
the output from lspci.  Attached is my kernel configuration.

I have the same kernel and configuration on my Dell D600 (an older
version of the same laptop), and hdparm –d works just fine.

Thanks in advance for your help!
Kristin Vadas Marsicano

** Start lspci output:
:00:00.0 Host bridge: Intel Corporation Mobile 915GM/PM/GMS/910GML
Express Processor to DRAM Controller (rev 03)
:00:02.0 VGA compatible controller: Intel Corporation Mobile
915GM/GMS/910GML Express Graphics Controller (rev 03)
:00:02.1 Display controller: Intel Corporation Mobile
915GM/GMS/910GML Express Graphics Controller (rev 03)
:00:1c.0 PCI bridge: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6
Family) PCI Express Port 1 (rev 03)
:00:1d.0 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW
(ICH6 Family) USB UHCI #1 (rev 03)
:00:1d.1 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW
(ICH6 Family) USB UHCI #2 (rev 03)
:00:1d.2 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW
(ICH6 Family) USB UHCI #3 (rev 03)
:00:1d.3 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW
(ICH6 Family) USB UHCI #4 (rev 03)
:00:1d.7 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW
(ICH6 Family) USB2 EHCI Controller (rev 03)
:00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev d3)
:00:1e.2 Multimedia audio controller: Intel Corporation
82801FB/FBM/FR/FW/FRW (ICH6 Family) AC'97 Audio Controller (rev 03)
:00:1e.3 Modem: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6
Family) AC'97 Modem Controller (rev 03)
:00:1f.0 ISA bridge: Intel Corporation 82801FBM (ICH6M) LPC
Interface Bridge (rev 03)
:00:1f.2 IDE interface: Intel Corporation 82801FBM (ICH6M) SATA
Controller (rev 03)
:02:00.0 Ethernet controller: Broadcom Corporation NetXtreme
BCM5751 Gigabit Ethernet PCI Express (rev 01)
:03:01.0 CardBus bridge: Texas Instruments: Unknown device 8036
:03:01.5 Communication controller: Texas Instruments: Unknown device 8038
:03:03.0 Network controller: Broadcom Corporation: Unknown device
4319 (rev 02)
 : End lspci output ***
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.22.6
# Fri Jan 11 09:49:10 2008
#
CONFIG_X86_32=y
CONFIG_GENERIC_TIME=y
CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_SEMAPHORE_SLEEPERS=y
CONFIG_X86=y
CONFIG_MMU=y
CONFIG_ZONE_DMA=y
CONFIG_QUICKLIST=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_IOMAP=y
CONFIG_GENERIC_BUG=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_DMI=y
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"

#
# Code maturity level options
#
CONFIG_EXPERIMENTAL=y
CONFIG_BROKEN_ON_SMP=y
CONFIG_LOCK_KERNEL=y
CONFIG_INIT_ENV_ARG_LIMIT=32

#
# General setup
#
CONFIG_LOCALVERSION=""
# CONFIG_LOCALVERSION_AUTO is not set
# CONFIG_SWAP is not set
CONFIG_SYSVIPC=y
# CONFIG_IPC_NS is not set
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
# CONFIG_BSD_PROCESS_ACCT is not set
# CONFIG_TASKSTATS is not set
# CONFIG_UTS_NS is not set
# CONFIG_AUDIT is not set
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_LOG_BUF_SHIFT=14
CONFIG_SYSFS_DEPRECATED=y
# CONFIG_RELAY is not set
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_SYSCTL=y
# CONFIG_EMBEDDED is not set
CONFIG_UID16=y
CONFIG_SYSCTL_SYSCALL=y
CONFIG_KALLSYMS=y
# CONFIG_KALLSYMS_EXTRA_PASS is not set
CONFIG_HOTPLUG=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_ANON_INODES=y
CONFIG_EPOLL=y
CONFIG_SIGNALFD=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_SHMEM=y
CONFIG_VM_EVENT_COUNTERS=y
CONFIG_SLAB=y
# CONFIG_SLUB is not set
# CONFIG_SLOB is not set
CONFIG_RT_MUTEXES=y
# CONFIG_TINY_SHMEM is not set
CONFIG_BASE_SMALL=0

#
# Loadable module support
#
CONFIG_MODULES=y
# CONFIG_MODULE_UNLOAD is not set
# CONFIG_MODVERSIONS is not set
# CONFIG_MODULE_SRCVERSION_ALL is not set
# CONFIG_KMOD is not set

#
# Block layer
#
CONFIG_BLOCK=y
# CONFIG_LBD is not set
# CONFIG_BLK_DEV_IO_TRACE is not set
# CONFIG_LSF is not set

#
# IO Schedulers
#
CONFIG_IOSCHED_NOOP=y
# CONFIG_IOSCHED_AS is not set
# CONFIG_IOSCHED_DEADLINE is not set
CONFIG_IOSCHED_CFQ=y
# CONFIG_DEFAULT_AS is not set
# CONFIG_DEFAULT_DEADLINE is not set
CONFIG_DEFAULT_CFQ=y
# CONFIG_DEFAULT_NOOP is not set
CONFIG_DEFAULT_IOSCHED="cfq"

#
# Processor type and features
#
# CONFIG_TICK_ONESHOT is not set
# CONFIG_NO_HZ is not set
# CONFIG_HIGH_RES_TIMERS is not set
# CONFIG_SMP is not set
CONFIG_X86_PC=y
# CONFIG_X86_ELAN is not set
# CONFIG_X86_VOYAGER is not set
# CONFIG_X86_NUMAQ is not set
# CONFIG_X86_SUMMIT i

Re: Trouble with hdparm -d on Dell D610

2008-01-11 Thread Kristin Vadas Marsicano
Thank you.  I took the CD-Rom out, so that's why it didn't show.  Very
observant!

My concern with disabling the new drivers is as follows: I use this
linux kernel and config image to boot machines over PXE and call a
shred program on each of the harddrives.  If I turn off CONFIG_ATA,
will this limit my ability to support various new IDE and SATA drives
for running shred?  So far, the configuration I have works well with
most of the machines I encounter  (and with both SATA and IDE drives),
except for the Dell D610 and HP 7700 (small desktop pc).  The models I
just mentioned run the shred really slow, which I believe is due to
the DMA problem I was having (outlined in my previous emails).  Any
thoughts?


On 1/11/08, Alan Cox <[EMAIL PROTECTED]> wrote:
> Thanks. You do indeed have both the old IDE and new IDE drivers trying to
> drive bits of the system. I don't see the CD-ROM in the dmesg at all
> however ?
>
> If you turn off CONFIG_ATA you should get just old IDE drivers and your
> disk back working sanely.
>
> Alan
>


-- 
Kristin Vadas Marsicano
[EMAIL PROTECTED]
kristinisme.blogspot.com
-
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: Trouble with hdparm -d on Dell D610

2008-01-11 Thread Alan Cox
Thanks. You do indeed have both the old IDE and new IDE drivers trying to
drive bits of the system. I don't see the CD-ROM in the dmesg at all
however ?

If you turn off CONFIG_ATA you should get just old IDE drivers and your
disk back working sanely.

Alan
-
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: Trouble with hdparm -d on Dell D610

2008-01-11 Thread Kristin Vadas Marsicano
Attached is the dmesg output.

On 1/11/08, Alan Cox <[EMAIL PROTECTED]> wrote:
> On Fri, 11 Jan 2008 14:49:46 -0500
> "Kristin Vadas Marsicano" <[EMAIL PROTECTED]> wrote:
>
> > Both laptops have IDE drives.  The kernel image booted on the two
> > laptops are exactly the same.  Please let me know if this doesn't
> > answer your question -- I'm new to this and not quite sure I
> > understand the question.
>
> Ok - can you send me a "dmesg" after you boot ?
>


-- 
Kristin Vadas Marsicano
[EMAIL PROTECTED]
kristinisme.blogspot.com
Linux version 2.6.22.6 ([EMAIL PROTECTED]) (gcc version 3.3.5 (Debian 
1:3.3.5-13)) #1 PREEMPT Tue Sep 25 14:43:08 EDT 2007
BIOS-provided physical RAM map:
 BIOS-e820:  - 0009f000 (usable)
 BIOS-e820: 0009f000 - 000a (reserved)
 BIOS-e820: 0010 - 1f7d1800 (usable)
 BIOS-e820: 1f7d1800 - 2000 (reserved)
 BIOS-e820: e000 - f0007000 (reserved)
 BIOS-e820: f0008000 - f000c000 (reserved)
 BIOS-e820: fec0 - fec1 (reserved)
 BIOS-e820: fed2 - fee1 (reserved)
 BIOS-e820: ffb0 - 0001 (reserved)
503MB LOWMEM available.
Entering add_active_range(0, 0, 128977) 0 entries of 256 used
Zone PFN ranges:
  DMA 0 -> 4096
  Normal   4096 ->   128977
early_node_map[1] active PFN ranges
0:0 ->   128977
On node 0 totalpages: 128977
  DMA zone: 32 pages used for memmap
  DMA zone: 0 pages reserved
  DMA zone: 4064 pages, LIFO batch:0
  Normal zone: 975 pages used for memmap
  Normal zone: 123906 pages, LIFO batch:31
DMI 2.3 present.
ACPI: RSDP 000FC9B0, 0014 (r0 DELL  )
ACPI: RSDT 1F7D1F90, 0040 (r1 DELLCPi R   27D50A02 ASL61)
ACPI: FACP 1F7D2C00, 0074 (r1 DELLCPi R   27D50A02 ASL61)
ACPI: DSDT 1F7D3800, 3C51 (r1 INT430 SYSFexxx 1001 MSFT  10E)
ACPI: FACS 1F7E2000, 0040
ACPI: APIC 1F7D3400, 0068 (r1 DELLCPi R   27D50A02 ASL47)
ACPI: ASF! 1F7D3000, 005B (r16 DELLCPi R   27D50A02 ASL61)
ACPI: MCFG 1F7D33C0, 003E (r16 DELLCPi R   27D50A02 ASL61)
ACPI: SSDT 1F7D23E6, 023E (r1  PmRef  Cpu0Ist 3000 INTL 20030522)
ACPI: SSDT 1F7D220E, 01D8 (r1  PmRef  Cpu0Cst 3001 INTL 20030522)
ACPI: SSDT 1F7D2013, 01FB (r1  PmRefCpuPm 3000 INTL 20030522)
ACPI: PM-Timer IO Port: 0x1008
Allocating PCI resources starting at 3000 (gap: 2000:c000)
Built 1 zonelists.  Total pages: 127970
Kernel command line: load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=61440 rw 
root=/dev/ram0 initrd=usmicro.pxe vga=0F07 splash quiet numpasses=1 
BOOT_IMAGE=vmlinuz.usmicro 
Enabling fast FPU save and restore... done.
Enabling unmasked SIMD FPU exception support... done.
Initializing CPU#0
PID hash table entries: 2048 (order: 11, 8192 bytes)
Detected 1729.180 MHz processor.
Console: colour VGA+ 80x25
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 489332k/515908k available (3011k kernel code, 25936k reserved, 1619k 
data, 316k init, 0k highmem)
virtual kernel memory layout:
fixmap  : 0x7000 - 0xf000   (  32 kB)
vmalloc : 0xe000 - 0x5000   ( 511 MB)
lowmem  : 0xc000 - 0xdf7d1000   ( 503 MB)
  .init : 0xc0588000 - 0xc05d7000   ( 316 kB)
  .data : 0xc03f0c40 - 0xc0585938   (1619 kB)
  .text : 0xc010 - 0xc03f0c40   (3011 kB)
Checking if this processor honours the WP bit even in supervisor mode... Ok.
Calibrating delay using timer specific routine.. 3461.72 BogoMIPS (lpj=6923455)
Mount-cache hash table entries: 512
CPU: After generic identify, caps: afe9fbff 0010   0180 
 
CPU: L1 I cache: 32K, L1 D cache: 32K
CPU: L2 cache: 2048K
CPU: After all inits, caps: afe9fbff 0010  2040 0180 
 
Intel machine check architecture supported.
Intel machine check reporting enabled on CPU#0.
Compat vDSO mapped to e000.
CPU: Intel(R) Pentium(R) M processor 1.73GHz stepping 08
Checking 'hlt' instruction... OK.
Checking for popad bug... OK.
ACPI: Core revision 20070126
ACPI: setting ELCR to 0200 (from 0e20)
NET: Registered protocol family 16
ACPI: bus type pci registered
PCI: Using MMCONFIG
Setting up standard PCI resources
ACPI: SSDT 1F7D1FD0, 0043 (r1  LMPWR  DELLLOM 1001 INTL 20030522)
ACPI: Interpreter enabled
ACPI: (supports S0 S3 S4 S5)
ACPI: Using PIC for interrupt routing
ACPI: PCI Root Bridge [PCI0] (:00)
PCI: Probing PCI hardware (bus 00)
PCI quirk: region 1000-107f claimed by ICH6 ACPI/GPIO/TCO
PCI quirk: region 1080-10bf claimed by ICH6 GPIO
PCI: Transparent bridge - :00:1e.0
ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]
ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.PCIE._PRT]
ACPI: PCI Interrupt Link [LNKA] (IRQs 9 10 *11)
ACPI: PCI Interrupt Link [LNKB] (IRQs 5 7) *10
ACPI: PCI Interrupt Link [LNKC] (IRQs *9 10 11)
ACP

Re: Trouble with hdparm -d on Dell D610

2008-01-11 Thread Alan Cox
> I have the same kernel and configuration on my Dell D600 (an older
> version of the same laptop), and hdparm –d works just fine.

We you using the IDE driver for PATA devices and the SATA driver for SATA
devices ? If so the really nasty hacks for that were dropped as current
libata PATA support is more than good enough for driving both ports and
having one driver for both cleaned up stuff a lot.

Alan
-
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: Trouble with hdparm -d on Dell D610

2008-01-11 Thread Alan Cox
On Fri, 11 Jan 2008 14:49:46 -0500
"Kristin Vadas Marsicano" <[EMAIL PROTECTED]> wrote:

> Both laptops have IDE drives.  The kernel image booted on the two
> laptops are exactly the same.  Please let me know if this doesn't
> answer your question -- I'm new to this and not quite sure I
> understand the question.

Ok - can you send me a "dmesg" after you boot ?
-
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 a bug of adma in rhel4u5 with HDS7250SASUN500G.

2008-01-11 Thread David Milburn

Robert Hancock wrote:

Kuan Luo wrote:


hi robert,
I have fixed a bug in rhel4u5 2.6.9-55 when running adma mode
with HDS7250SASUN500G.
Could you check this code and if no problem,  then help me to
submit to the newest kernel.



It seems like a reasonable change - I'm sure you guys would know better 
than I whether it's the right thing to do. The patch got newline wrapped 
and whitespace damaged, however. Can you repost (even as attachment) so 
people can try it out?


Robert,

Here is Kuan's patch as an attachment.

David





for 2.6.9-55
diff -Nupr a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
--- a/drivers/ata/sata_nv.c2008-01-14 14:37:32.0 +0800
+++ b/drivers/ata/sata_nv.c2008-01-14 14:37:21.0 +0800
@@ -802,7 +802,7 @@ static irqreturn_t nv_adma_interrupt(int
 ata_port_printk(ap, KERN_ERR, "CPB
error, stat=0x%x\n", status);
 have_global_err = 1;
 }
-if ((status & NV_ADMA_STAT_DONE) ||
have_global_err) {
+if ((status & (NV_ADMA_STAT_CMD_COMPLETE |
NV_ADMA_STAT_DONE)) || have_global_err) {
 /** Check CPBs for completed commands */
 
 if(ata_tag_valid(ap->active_tag))

@@ -814,6 +814,7 @@ static irqreturn_t nv_adma_interrupt(int
 u32 active = ap->sactive;
 while( (pos = ffs(active)) ) {
 pos--;
+if ((notifier_clears[i]
& (1 << pos)) || have_global_err)
 nv_adma_check_cpb(ap,
pos, have_global_err ||
 (notifier_error
& (1 << pos)) );
 active &= ~(1 << pos );

for 2.6.24-rc7

diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index ed5dc7c..6bffd39 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -1010,8 +1010,7 @@ static irqreturn_t nv_adma_interrupt(int irq, void
*dev_instance)
 continue;
 }
 
-if (status & (NV_ADMA_STAT_DONE |

-  NV_ADMA_STAT_CPBERR)) {
+if (status & (NV_ADMA_STAT_DONE |
NV_ADMA_STAT_CMD_COMPLETE | NV_ADMA_STAT_CPBERR)) {
 u32 check_commands;
 int pos, error = 0;
 
@@ -1023,8 +1022,8 @@ static irqreturn_t nv_adma_interrupt(int irq, void

*dev_instance)
 /** Check CPBs for completed commands */
 while ((pos = ffs(check_commands)) &&
!error) {
 pos--;
-error = nv_adma_check_cpb(ap,
pos,
-notifier_error & (1 <<
pos));
+if ((notifier_clears[i] & (1 <<
pos)) || (status & NV_ADMA_STAT_CPBERR))
+error =
nv_adma_check_cpb(ap, pos, notifier_error & (1 << pos));
 check_commands &= ~(1 << pos);
 }
 }
--- 

This email message is for the sole use of the intended recipient(s) 
and may contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact 
the sender by

reply email and destroy all copies of the original message.
--- 




-
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


--- linux-2.6/drivers/ata/sata_nv.c.completed
+++ linux-2.6/drivers/ata/sata_nv.c
@@ -1011,7 +1011,8 @@ static irqreturn_t nv_adma_interrupt(int
 			}
 
 			if (status & (NV_ADMA_STAT_DONE |
-  NV_ADMA_STAT_CPBERR)) {
+  NV_ADMA_STAT_CPBERR |
+  NV_ADMA_STAT_CMD_COMPLETE)) {
 u32 check_commands;
 int pos, error = 0;
 
@@ -1023,8 +1024,8 @@ static irqreturn_t nv_adma_interrupt(int
 /** Check CPBs for completed commands */
 while ((pos = ffs(check_commands)) && !error) {
 	pos--;
-	error = nv_adma_check_cpb(ap, pos,
-		notifier_error & (1 << pos));
+	if ((notifier_clears[i] & (1 << pos)) || (status & NV_ADMA_STAT_CPBERR))
+		error = nv_adma_check_cpb(ap, pos, notifier_error & (1 << pos));
 	check_commands &= ~(1 << pos);
 }
 			}


Re: Trouble with hdparm -d on Dell D610

2008-01-11 Thread Kristin Vadas Marsicano
On 1/11/08, Alan Cox <[EMAIL PROTECTED]> wrote:
> > My concern with disabling the new drivers is as follows: I use this
> > linux kernel and config image to boot machines over PXE and call a
> > shred program on each of the harddrives.  If I turn off CONFIG_ATA,
> > will this limit my ability to support various new IDE and SATA drives
> > for running shred?  So far, the configuration I have works well with
>
> Yes. In that case you can build without CONFIG_IDE_PIIX and with the
> CONFIG_ATA_PIIX driver and you should be fine too (but your disk will
> move to /dev/sda on that box). The PIIX is an awkward case as in some
> modes it combines both the SATA and PATA onto one 'device'.
>

Can I set this option through make menuconfig, or do I need to take
some other action?  I poked around the menu config a big and wasn't
sure I found the properties you are refering to.

Would all my disks then be listed as sd[a-z] on every machine?  Or just some?

> > most of the machines I encounter  (and with both SATA and IDE drives),
> > except for the Dell D610 and HP 7700 (small desktop pc).  The models I
> > just mentioned run the shred really slow, which I believe is due to
> > the DMA problem I was having (outlined in my previous emails).  Any
> > thoughts?
>
> If your shred program is relying on DMA then you are using the wrong tool
> for the job. The correct way to erase a disk is to send it a security
> erase command. Rewriting over the data may not do what is wanted.
>

For now, my desired action is to overwrite the drives with random
characters.  My understanding is that security erase commands are
implemented in the firmware, and that it may be buggy.  Please correct
me if my understanding is incorrect.  Also, is there a way to invoke
the firmware security erase with a linux command?


-- 
Kristin Vadas Marsicano
[EMAIL PROTECTED]
kristinisme.blogspot.com
-
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: Trouble with hdparm -d on Dell D610

2008-01-11 Thread Greg Freemyer
On Jan 11, 2008 4:34 PM, Alan Cox <[EMAIL PROTECTED]> wrote:
> > most of the machines I encounter  (and with both SATA and IDE drives),
> > except for the Dell D610 and HP 7700 (small desktop pc).  The models I
> > just mentioned run the shred really slow, which I believe is due to
> > the DMA problem I was having (outlined in my previous emails).  Any
> > thoughts?
>
> If your shred program is relying on DMA then you are using the wrong tool
> for the job. The correct way to erase a disk is to send it a security
> erase command. Rewriting over the data may not do what is wanted.

Alan,

I was talking to Kristin this morning about doing that.  I was
concerned that there is not anybody certifying that each individual
disk drive model / firmware release is properly implementing the
Security Erase function.

Are you aware of testing body, etc. that publishes a white-list of
drives that are known to have a proper implementation of Security
Erase?  Lacking something like that and realizing how rarely it is
used, I'm not sure it should be trusted.

Performing both a Security Erase and calling shred on the drive might
be the ultimate one-two punch.

Greg
-- 
Greg Freemyer
Litigation Triage Solutions Specialist
http://www.linkedin.com/in/gregfreemyer
First 99 Days Litigation White Paper -
http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf

The Norcross Group
The Intersection of Evidence & Technology
http://www.norcrossgroup.com
-
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: LIBATA SCSI command validation changed in 2.6.24

2008-01-11 Thread Chuck Ebbert
On 01/11/2008 04:35 PM, Jeff Garzik wrote:
> Chuck Ebbert wrote:
>> commit 607126c2a21cd6e9bb807fdd415c1a992f7b9009 changed command
>> validation
>> to allow short commands in 16-byte CDBs, but it also made checking more
>> strict. Before the change, a 10-byte SG_IO command could have its
>> length set
>> to 9 and still work. Now it fails. Not sure if this is a bug, but it has
>> caused at least one application to fail that used to work (qpxtool.)
>>
>> [https://bugzilla.redhat.com/show_bug.cgi?id=428281]
> 
> Can you get us an example CDB?  Its unclear if the hexdump in the bug
> report is a returned mode page or the CDB or what...?
> 

Not easily, but the maintainer of that program forced the length of
the MODE_SENSE(10) command to 10 and that command started working.

By looking at the source I could tell that it was setting the command
length to (1 + the index of the last byte written to the CDB) and
only wrote up to offset 8 when building the command, so it must have
been sending the command with a length of 9. (It zeroed the whole CDB
first and only wrote what it needed to.)

(And it used the C++ operator [] to build the command, that was fun
to trace...)
-
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: Trouble with hdparm -d on Dell D610

2008-01-11 Thread Greg Freemyer
On Jan 11, 2008 4:49 PM, Kristin Vadas Marsicano
<[EMAIL PROTECTED]> wrote:
> On 1/11/08, Alan Cox <[EMAIL PROTECTED]> wrote:
> > > My concern with disabling the new drivers is as follows: I use this
> > > linux kernel and config image to boot machines over PXE and call a
> > > shred program on each of the harddrives.  If I turn off CONFIG_ATA,
> > > will this limit my ability to support various new IDE and SATA drives
> > > for running shred?  So far, the configuration I have works well with
> >
> > Yes. In that case you can build without CONFIG_IDE_PIIX and with the
> > CONFIG_ATA_PIIX driver and you should be fine too (but your disk will
> > move to /dev/sda on that box). The PIIX is an awkward case as in some
> > modes it combines both the SATA and PATA onto one 'device'.
> >
>
> Can I set this option through make menuconfig, or do I need to take
> some other action?  I poked around the menu config a big and wasn't
> sure I found the properties you are refering to.
>
> Would all my disks then be listed as sd[a-z] on every machine?  Or just some?
>
> > > most of the machines I encounter  (and with both SATA and IDE drives),
> > > except for the Dell D610 and HP 7700 (small desktop pc).  The models I
> > > just mentioned run the shred really slow, which I believe is due to
> > > the DMA problem I was having (outlined in my previous emails).  Any
> > > thoughts?
> >
> > If your shred program is relying on DMA then you are using the wrong tool
> > for the job. The correct way to erase a disk is to send it a security
> > erase command. Rewriting over the data may not do what is wanted.
> >
>
> For now, my desired action is to overwrite the drives with random
> characters.  My understanding is that security erase commands are
> implemented in the firmware, and that it may be buggy.  Please correct
> me if my understanding is incorrect.  Also, is there a way to invoke
> the firmware security erase with a linux command?

Kristin, you can issue Security Erase via hdparm, but don't forget
that the Security Erase command is blocked by significant number of
BIOS implentations, so switching to it would be a fundamental change
to what you do now even if you had confidence that it did work 100% of
the time.

Greg
-- 
Greg Freemyer
Litigation Triage Solutions Specialist
http://www.linkedin.com/in/gregfreemyer
First 99 Days Litigation White Paper -
http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf

The Norcross Group
The Intersection of Evidence & Technology
http://www.norcrossgroup.com
-
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: Trouble with hdparm -d on Dell D610

2008-01-11 Thread Kristin Vadas Marsicano
Both laptops have IDE drives.  The kernel image booted on the two
laptops are exactly the same.  Please let me know if this doesn't
answer your question -- I'm new to this and not quite sure I
understand the question.

Thanks for the quick reply!

On 1/11/08, Alan Cox <[EMAIL PROTECTED]> wrote:
> > I have the same kernel and configuration on my Dell D600 (an older
> > version of the same laptop), and hdparm –d works just fine.
>
> We you using the IDE driver for PATA devices and the SATA driver for SATA
> devices ? If so the really nasty hacks for that were dropped as current
> libata PATA support is more than good enough for driving both ports and
> having one driver for both cleaned up stuff a lot.
>
> Alan
>


-- 
Kristin Vadas Marsicano
[EMAIL PROTECTED]
kristinisme.blogspot.com
-
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: Trouble with hdparm -d on Dell D610

2008-01-11 Thread Alan Cox
> My concern with disabling the new drivers is as follows: I use this
> linux kernel and config image to boot machines over PXE and call a
> shred program on each of the harddrives.  If I turn off CONFIG_ATA,
> will this limit my ability to support various new IDE and SATA drives
> for running shred?  So far, the configuration I have works well with

Yes. In that case you can build without CONFIG_IDE_PIIX and with the
CONFIG_ATA_PIIX driver and you should be fine too (but your disk will
move to /dev/sda on that box). The PIIX is an awkward case as in some
modes it combines both the SATA and PATA onto one 'device'.

> most of the machines I encounter  (and with both SATA and IDE drives),
> except for the Dell D610 and HP 7700 (small desktop pc).  The models I
> just mentioned run the shred really slow, which I believe is due to
> the DMA problem I was having (outlined in my previous emails).  Any
> thoughts?

If your shred program is relying on DMA then you are using the wrong tool
for the job. The correct way to erase a disk is to send it a security
erase command. Rewriting over the data may not do what is wanted.
-
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: LIBATA SCSI command validation changed in 2.6.24

2008-01-11 Thread Jeff Garzik

Chuck Ebbert wrote:

commit 607126c2a21cd6e9bb807fdd415c1a992f7b9009 changed command validation
to allow short commands in 16-byte CDBs, but it also made checking more
strict. Before the change, a 10-byte SG_IO command could have its length set
to 9 and still work. Now it fails. Not sure if this is a bug, but it has
caused at least one application to fail that used to work (qpxtool.)

[https://bugzilla.redhat.com/show_bug.cgi?id=428281]


Can you get us an example CDB?  Its unclear if the hexdump in the bug 
report is a returned mode page or the CDB or what...?


Jeff




-
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


LIBATA SCSI command validation changed in 2.6.24

2008-01-11 Thread Chuck Ebbert
commit 607126c2a21cd6e9bb807fdd415c1a992f7b9009 changed command validation
to allow short commands in 16-byte CDBs, but it also made checking more
strict. Before the change, a 10-byte SG_IO command could have its length set
to 9 and still work. Now it fails. Not sure if this is a bug, but it has
caused at least one application to fail that used to work (qpxtool.)

[https://bugzilla.redhat.com/show_bug.cgi?id=428281]
-
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: sata_nv + ADMA + Samsung disk problem

2008-01-11 Thread Gabor Gombas
On Mon, Jan 07, 2008 at 06:10:29PM -0600, Robert Hancock wrote:

> Gabor, I just noticed you said that it worked OK in 2.6.20, yet 2.6.22  
> fails. 2.6.20 had ADMA support as well, so I wonder what change started  
> causing the problem. Would it be possible for you to do a git bisect (or  
> at least try 2.6.21 to try and narrow it down)?

I've now booted 2.6.21.7, we'll see. The problem with the bisection is
that I can't explicitely trigger the bug so I can't say for sure if a
kernel is good or it is just needs more time to trigger. The average
uptime of this machine is just a couple hours a day.

For example, with 2.6.24-rc6 it took over 3 hours for the first disk to
trigger the bug and the second disk needed more than 7 hours. This
machine is seldom turned on for that long.

Gabor

-- 
 -
 MTA SZTAKI Computer and Automation Research Institute
Hungarian Academy of Sciences
 -
-
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: LIBATA SCSI command validation changed in 2.6.24

2008-01-11 Thread Jeff Garzik

Chuck Ebbert wrote:

On 01/11/2008 04:35 PM, Jeff Garzik wrote:

Chuck Ebbert wrote:

commit 607126c2a21cd6e9bb807fdd415c1a992f7b9009 changed command
validation
to allow short commands in 16-byte CDBs, but it also made checking more
strict. Before the change, a 10-byte SG_IO command could have its
length set
to 9 and still work. Now it fails. Not sure if this is a bug, but it has
caused at least one application to fail that used to work (qpxtool.)

[https://bugzilla.redhat.com/show_bug.cgi?id=428281]

Can you get us an example CDB?  Its unclear if the hexdump in the bug
report is a returned mode page or the CDB or what...?



Not easily, but the maintainer of that program forced the length of
the MODE_SENSE(10) command to 10 and that command started working.

By looking at the source I could tell that it was setting the command
length to (1 + the index of the last byte written to the CDB) and
only wrote up to offset 8 when building the command, so it must have
been sending the command with a length of 9. (It zeroed the whole CDB
first and only wrote what it needed to.)

(And it used the C++ operator [] to build the command, that was fun
to trace...)


Even if allocation length is present in the CDB, the CDB may be missing 
important information that is required to process the command.  So it 
may have caught a bug in the program... depending on the CDB.


Jeff


-
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: LIBATA SCSI command validation changed in 2.6.24

2008-01-11 Thread Chuck Ebbert
On 01/11/2008 06:21 PM, Jeff Garzik wrote:
> Chuck Ebbert wrote:
>> On 01/11/2008 04:35 PM, Jeff Garzik wrote:
>>> Chuck Ebbert wrote:
 commit 607126c2a21cd6e9bb807fdd415c1a992f7b9009 changed command
 validation
 to allow short commands in 16-byte CDBs, but it also made checking more
 strict. Before the change, a 10-byte SG_IO command could have its
 length set
 to 9 and still work. Now it fails. Not sure if this is a bug, but it
 has
 caused at least one application to fail that used to work (qpxtool.)

 [https://bugzilla.redhat.com/show_bug.cgi?id=428281]
>>> Can you get us an example CDB?  Its unclear if the hexdump in the bug
>>> report is a returned mode page or the CDB or what...?
>>>
>>
>> Not easily, but the maintainer of that program forced the length of
>> the MODE_SENSE(10) command to 10 and that command started working.
>>
>> By looking at the source I could tell that it was setting the command
>> length to (1 + the index of the last byte written to the CDB) and
>> only wrote up to offset 8 when building the command, so it must have
>> been sending the command with a length of 9. (It zeroed the whole CDB
>> first and only wrote what it needed to.)
>>
>> (And it used the C++ operator [] to build the command, that was fun
>> to trace...)
> 
> Even if allocation length is present in the CDB, the CDB may be missing
> important information that is required to process the command.  So it
> may have caught a bug in the program... depending on the CDB.
> 

Yeah, the change is probably good. We should have been validating that
the length was at least as long the expected length all along. But some
programs are going to break because of this...
-
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: Trouble with hdparm -d on Dell D610

2008-01-11 Thread Alan Cox
> I was talking to Kristin this morning about doing that.  I was
> concerned that there is not anybody certifying that each individual
> disk drive model / firmware release is properly implementing the
> Security Erase function.
> 
> Are you aware of testing body, etc. that publishes a white-list of
> drives that are known to have a proper implementation of Security
> Erase?  Lacking something like that and realizing how rarely it is
> used, I'm not sure it should be trusted.

That would be a question to ask some of the security bodies - or possible
T13 (the standards people). Given there are only about 4 major drive
vendors left it sohuldn't take long to ask them however.

> Performing both a Security Erase and calling shred on the drive might
> be the ultimate one-two punch.

Can't do any harm - and in theory drives can reject (not ignore!)
security erase. Some mini ones seem to.

-
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 a bug of adma in rhel4u5 with HDS7250SASUN500G.

2008-01-11 Thread Robert Hancock

Kuan Luo wrote:

hi robert,
I have fixed a bug in rhel4u5 2.6.9-55 when running adma mode
with HDS7250SASUN500G.
Could you check this code and if no problem,  then help me to
submit to the newest kernel.



What problem does this resolve? I tested it against the cache flush/NCQ 
write switching problem we've been trying to solve, and it doesn't look 
like it fixes that one - if I apply this patch and then remove the 
udelay(20) in sata_nv.c that I added which prevented me from seeing this 
problem before, it shows up.


If you want to try and reproduce that problem, you can take out this 
udelay(20) from the current version:


if (curr_ncq != pp->last_issue_ncq) {
/* Seems to need some delay before switching between NCQ and
   non-NCQ commands, else we get command timeouts and such. */
udelay(20);
pp->last_issue_ncq = curr_ncq;
}

then run 2 instances of this C program, with different output files as 
the argument:


#include 
#include 
#include 
#include 
#include 
#include 

int main(int argc, char* argv[])
{
int i;
int fd = open( argv[1], O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | 
S_IWUSR);
if(fd == -1)
{
perror("open");
return 1;
}
for(i=0;i<100;i++)
{
int rc = write(fd, "0", 1);
if( rc != 1 )
{
perror("write");
return 2;
}
rc = fsync(fd);
if(rc)
{
perror("fsync");
return 2;
}
}
return 0;
}

and one instance of this:

dd if=/dev/zero of=blankfile bs=512 count=10 oflag=direct

and one of this:

while /bin/true; do sdparm --command=sync /dev/sdb; done

all at the same time. In my experience, it helps to disable cpufreq (on 
Red Hat/Fedora, /sbin/service cpuspeed stop) to force the CPU to run at 
max frequency all the time. After a few minutes I got this:


ata4: EH in ADMA mode, notifier 0x0 notifier_error 0x0 gen_ctl 0x1501000 
status 0x400 next cpb count 0x2 next cpb idx 0x0

ata4: CPB 0: ctl_flags 0x1f, resp_flags 0x0
ata4: CPB 1: ctl_flags 0x1f, resp_flags 0x0
ata4: CPB 2: ctl_flags 0x1f, resp_flags 0x0
ata4: timeout waiting for ADMA IDLE, stat=0x400
ata4: timeout waiting for ADMA LEGACY, stat=0x400
ata4.00: exception Emask 0x0 SAct 0x7 SErr 0x0 action 0x2 frozen
ata4.00: cmd 61/08:00:e0:74:64/00:00:0a:00:00/40 tag 0 ncq 4096 out
 res 40/00:01:00:4f:c2/00:00:00:00:00/00 Emask 0x4 (timeout)
ata4.00: status: { DRDY }
ata4.00: cmd 61/08:08:30:5b:76/00:00:0c:00:00/40 tag 1 ncq 4096 out
 res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
ata4.00: status: { DRDY }
ata4.00: cmd 61/01:10:ba:51:77/00:00:0c:00:00/40 tag 2 ncq 512 out
 res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
ata4.00: status: { DRDY }
ata4: soft resetting link
ata4: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
ata4.00: configured for UDMA/133
ata4: EH complete
-
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: sata_nv + ADMA + Samsung disk problem

2008-01-11 Thread Robert Hancock

Gabor Gombas wrote:

On Mon, Jan 07, 2008 at 06:10:29PM -0600, Robert Hancock wrote:

Gabor, I just noticed you said that it worked OK in 2.6.20, yet 2.6.22  
fails. 2.6.20 had ADMA support as well, so I wonder what change started  
causing the problem. Would it be possible for you to do a git bisect (or  
at least try 2.6.21 to try and narrow it down)?


I've now booted 2.6.21.7, we'll see. The problem with the bisection is
that I can't explicitely trigger the bug so I can't say for sure if a
kernel is good or it is just needs more time to trigger. The average
uptime of this machine is just a couple hours a day.

For example, with 2.6.24-rc6 it took over 3 hours for the first disk to
trigger the bug and the second disk needed more than 7 hours. This
machine is seldom turned on for that long.


If you want to try to reproduce the problem more rapidly, you can try 
the recipe I just suggested to the NVIDIA guys:


Run 2 instances of this C program, with different output files as the 
argument, i.e. save this to fsynctest.c, and do

gcc fsynctest.c -o fsynctest
./fsynctest testfile & ./fsynctest testfile2 &

#include 
#include 
#include 
#include 
#include 
#include 

int main(int argc, char* argv[])
{
int i;
int fd = open( argv[1], O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | 
S_IWUSR);

if(fd == -1)
{
perror("open");
return 1;
}
for(i=0;i<100;i++)
{
int rc = write(fd, "0", 1);
if( rc != 1 )
{
perror("write");
return 2;
}
rc = fsync(fd);
if(rc)
{
perror("fsync");
return 2;
}
}
return 0;
}

Also run one instance of this:

dd if=/dev/zero of=blankfile bs=512 count=10 oflag=direct

and one of this:

while /bin/true; do sdparm --command=sync /dev/sdb; done

all at the same time. In my experience, it helps to disable cpufreq (on 
Red Hat/Fedora, /sbin/service cpuspeed stop) to force the CPU to run at 
max frequency all the time. After a few minutes I got this:


ata4: EH in ADMA mode, notifier 0x0 notifier_error 0x0 gen_ctl 0x1501000 
status 0x400 next cpb count 0x2 next cpb idx 0x0

ata4: CPB 0: ctl_flags 0x1f, resp_flags 0x0
ata4: CPB 1: ctl_flags 0x1f, resp_flags 0x0
ata4: CPB 2: ctl_flags 0x1f, resp_flags 0x0
ata4: timeout waiting for ADMA IDLE, stat=0x400
ata4: timeout waiting for ADMA LEGACY, stat=0x400
ata4.00: exception Emask 0x0 SAct 0x7 SErr 0x0 action 0x2 frozen
ata4.00: cmd 61/08:00:e0:74:64/00:00:0a:00:00/40 tag 0 ncq 4096 out
 res 40/00:01:00:4f:c2/00:00:00:00:00/00 Emask 0x4 (timeout)
ata4.00: status: { DRDY }
ata4.00: cmd 61/08:08:30:5b:76/00:00:0c:00:00/40 tag 1 ncq 4096 out
 res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
ata4.00: status: { DRDY }
ata4.00: cmd 61/01:10:ba:51:77/00:00:0c:00:00/40 tag 2 ncq 512 out
 res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
ata4.00: status: { DRDY }
ata4: soft resetting link
ata4: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
ata4.00: configured for UDMA/133
ata4: EH complete

-
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: 40-wire cable detected when directly connected

2008-01-11 Thread Tejun Heo
[cc'ing Alan, thanks for the information on the other message]

Tobias Müller wrote:
> Tejun Heo schrieb:
>> I don't know very well about CF but does it even fill UDMA/33?  What
>> does 'dd if=/dev/sdc of=/dev/null bs=1M count=16 iflag=direct' say?  You
>> can increase count for more reliable result.
> 
> 16+0 Datensätze ein
> 16+0 Datensätze aus
> 16777216 Bytes (17 MB) kopiert, 0,561688 s, 29,9 MB/s

Hmmm... yeah, it almost fills UDMA/33.  I wonder whether it would go higher.

> And hdparm -I /dev/sdc says it should be compatible to udma5.
> 
> DMA: mdma0 mdma1 mdma2 udma0 udma1 *udma2 udma3 udma4

Please apply the attached patch and specify libata.force_cbl=80 as
kernel boot parameter.  If you load libata from initrd or after boot you
need to pass 'force_cbl=80' as module parameter.  How you do it depends
on your distro.

Thanks.

-- 
tejun
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 4753a18..8c93878 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -119,6 +119,10 @@ int libata_noacpi = 0;
 module_param_named(noacpi, libata_noacpi, int, 0444);
 MODULE_PARM_DESC(noacpi, "Disables the use of ACPI in probe/suspend/resume 
when set");
 
+int libata_force_cbl = 0;
+module_param_named(force_cbl, libata_force_cbl, int, 0644);
+MODULE_PARM_DESC(force_cbl, "force PATA cable type (0=keep, 40=40c, 80=80c)");
+
 MODULE_AUTHOR("Jeff Garzik");
 MODULE_DESCRIPTION("Library module for ATA devices");
 MODULE_LICENSE("GPL");
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 21a81cd..7e53215 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2296,9 +2296,27 @@ static int ata_eh_revalidate_and_attach(struct ata_link 
*link,
 
/* PDIAG- should have been released, ask cable type if post-reset */
if (ata_is_host_link(link) && ap->ops->cable_detect &&
-   (ehc->i.flags & ATA_EHI_DID_RESET))
+   (ehc->i.flags & ATA_EHI_DID_RESET)) {
ap->cbl = ap->ops->cable_detect(ap);
 
+   if (!(ap->flags & ATA_FLAG_SATA) && libata_force_cbl) {
+   switch (libata_force_cbl) {
+   case 40:
+   ata_port_printk(ap, KERN_INFO, "forcing 40c\n");
+   ap->cbl = ATA_CBL_PATA40;
+   break;
+   case 80:
+   ata_port_printk(ap, KERN_INFO, "forcing 80c\n");
+   ap->cbl = ATA_CBL_PATA80;
+   break;
+   default:
+   ata_port_printk(ap, KERN_WARNING,
+   "invalid force_cbl value %d\n",
+   libata_force_cbl);
+   }
+   }
+   }
+
/* Configure new devices forward such that user doesn't see
 * device detection messages backwards.
 */
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index bbe59c2..b990a8d 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -60,6 +60,7 @@ extern int atapi_dmadir;
 extern int atapi_passthru16;
 extern int libata_fua;
 extern int libata_noacpi;
+extern int libata_force_cbl;
 extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev);
 extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
   u64 block, u32 n_block, unsigned int tf_flags,


Re: Trouble with hdparm -d on Dell D610

2008-01-11 Thread Mark Lord

Kristin Vadas Marsicano wrote:

..
For now, my desired action is to overwrite the drives with random
characters.  My understanding is that security erase commands are
implemented in the firmware, and that it may be buggy.  Please correct
me if my understanding is incorrect.  Also, is there a way to invoke
the firmware security erase with a linux command?

..

For libata managed drives (/dev/sd*):

   hdparm --security-erase ...

(see also:  hdparm --security-help)
-
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