linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* PATCH: fixup incomplete ident blocks on ITE raid volumes
@ 2004-08-15 14:45 Alan Cox
  2004-08-15 20:28 ` Martin Schlemmer
  2004-08-16 15:16 ` Bartlomiej Zolnierkiewicz
  0 siblings, 2 replies; 6+ messages in thread
From: Alan Cox @ 2004-08-15 14:45 UTC (permalink / raw)
  To: linux-ide, linux-kernel, torvalds

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.8-rc3/drivers/ide/ide-probe.c linux-2.6.8-rc3/drivers/ide/ide-probe.c
--- linux.vanilla-2.6.8-rc3/drivers/ide/ide-probe.c	2004-08-09 15:51:00.000000000 +0100
+++ linux-2.6.8-rc3/drivers/ide/ide-probe.c	2004-08-14 21:03:03.000000000 +0100
@@ -542,7 +542,51 @@
 }
 
 /**
- *	probe_for_drives	-	upper level drive probe
+ *	ident_quirks	-	drive ident mangler
+ *	@drive: drive to check
+ *
+ *	Take the returned ident block for the drive and see if it
+ *	is one of the broken ones. We still broken ident fixups in
+ *	multiple places, we should migrate some of the others here.
+ */
+static void ident_quirks(ide_drive_t *drive)
+{
+	struct hd_driveid *id = drive->id;
+	u16 *idbits = (u16 *)id;
+	
+	if(strstr(id->model, "Integrated Technology Express"))
+	{
+		/* IT821x raid volume with bogus ident block */
+		if(id->lba_capacity >= 0x200000)
+		{
+			id->sectors = 63;
+			id->heads = 255;
+		}
+		else
+		{
+			id->sectors = 32;
+			id->heads = 64;
+		}
+		id->cyls = 1 + id->lba_capacity_2 / (id->heads * id->sectors);
+		/* LBA28 is ok, DMA is ok, UDMA data is valid */
+		id->capability |= 3;
+		id->field_valid |= 7;
+		/* LBA48 is ok */
+		id->command_set_2 |= 0x0400;
+		id->cfs_enable_2 |= 0x0400;
+		/* Flush is ok */
+		id->cfs_enable_2 |= 0x3000;
+		printk(KERN_WARNING "%s: IT8212 %sRAID %d volume",
+			drive->name,
+			idbits[147] ? "Bootable ":"",
+			idbits[129]);
+		if(idbits[129] != 1)
+			printk("(%dK stripe)", idbits[146]);
+		printk(".\n");
+	}		
+}
+/**
+ *	probe_for_drive	-	upper level drive probe
  *	@drive: drive to probe for
  *
  *	probe_for_drive() tests for existence of a given drive using do_probe()
@@ -553,7 +597,7 @@
  *			   still be 0)
  */
  
-static inline u8 probe_for_drive (ide_drive_t *drive)
+static u8 probe_for_drive(ide_drive_t *drive)
 {
 	/*
 	 *	In order to keep things simple we have an id
@@ -602,6 +646,7 @@
 				drive->present = 0;
 			}
 		}
+		ident_quirks(drive);
 		/* drive was found */
 	}
 	if(!drive->present)


Signed-off-by: Alan Cox


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: fixup incomplete ident blocks on ITE raid volumes
  2004-08-15 20:28 ` Martin Schlemmer
@ 2004-08-15 20:27   ` Alan Cox
  0 siblings, 0 replies; 6+ messages in thread
From: Alan Cox @ 2004-08-15 20:27 UTC (permalink / raw)
  To: Martin Schlemmer
  Cc: Alan Cox, linux-ide, Linux Kernel Mailing Lists, torvalds

On Sun, Aug 15, 2004 at 10:28:13PM +0200, Martin Schlemmer wrote:
> > +		}
> > +		id->cyls = 1 + id->lba_capacity_2 / (id->heads * id->sectors);
> > +		/* LBA28 is ok, DMA is ok, UDMA data is valid */

Change that to use sector_div() and it should be fine. My gcc didn't end
up generating internal gcc library helpers for that so I didnt notice.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: fixup incomplete ident blocks on ITE raid volumes
  2004-08-15 14:45 PATCH: fixup incomplete ident blocks on ITE raid volumes Alan Cox
@ 2004-08-15 20:28 ` Martin Schlemmer
  2004-08-15 20:27   ` Alan Cox
  2004-08-16 15:16 ` Bartlomiej Zolnierkiewicz
  1 sibling, 1 reply; 6+ messages in thread
From: Martin Schlemmer @ 2004-08-15 20:28 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-ide, Linux Kernel Mailing Lists, torvalds

[-- Attachment #1: Type: text/plain, Size: 2602 bytes --]

On Sun, 2004-08-15 at 16:45, Alan Cox wrote:
> diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.8-rc3/drivers/ide/ide-probe.c linux-2.6.8-rc3/drivers/ide/ide-probe.c
> --- linux.vanilla-2.6.8-rc3/drivers/ide/ide-probe.c	2004-08-09 15:51:00.000000000 +0100
> +++ linux-2.6.8-rc3/drivers/ide/ide-probe.c	2004-08-14 21:03:03.000000000 +0100
> @@ -542,7 +542,51 @@
>  }
>  
>  /**
> - *	probe_for_drives	-	upper level drive probe
> + *	ident_quirks	-	drive ident mangler
> + *	@drive: drive to check
> + *
> + *	Take the returned ident block for the drive and see if it
> + *	is one of the broken ones. We still broken ident fixups in
> + *	multiple places, we should migrate some of the others here.
> + */
> +static void ident_quirks(ide_drive_t *drive)
> +{
> +	struct hd_driveid *id = drive->id;
> +	u16 *idbits = (u16 *)id;
> +	
> +	if(strstr(id->model, "Integrated Technology Express"))
> +	{
> +		/* IT821x raid volume with bogus ident block */
> +		if(id->lba_capacity >= 0x200000)
> +		{
> +			id->sectors = 63;
> +			id->heads = 255;
> +		}
> +		else
> +		{
> +			id->sectors = 32;
> +			id->heads = 64;
> +		}
> +		id->cyls = 1 + id->lba_capacity_2 / (id->heads * id->sectors);
> +		/* LBA28 is ok, DMA is ok, UDMA data is valid */
> +		id->capability |= 3;
> +		id->field_valid |= 7;
> +		/* LBA48 is ok */
> +		id->command_set_2 |= 0x0400;
> +		id->cfs_enable_2 |= 0x0400;
> +		/* Flush is ok */
> +		id->cfs_enable_2 |= 0x3000;
> +		printk(KERN_WARNING "%s: IT8212 %sRAID %d volume",
> +			drive->name,
> +			idbits[147] ? "Bootable ":"",
> +			idbits[129]);
> +		if(idbits[129] != 1)
> +			printk("(%dK stripe)", idbits[146]);
> +		printk(".\n");
> +	}		
> +}
> +/**
> + *	probe_for_drive	-	upper level drive probe
>   *	@drive: drive to probe for
>   *
>   *	probe_for_drive() tests for existence of a given drive using do_probe()
> @@ -553,7 +597,7 @@
>   *			   still be 0)
>   */
>   
> -static inline u8 probe_for_drive (ide_drive_t *drive)
> +static u8 probe_for_drive(ide_drive_t *drive)
>  {
>  	/*
>  	 *	In order to keep things simple we have an id
> @@ -602,6 +646,7 @@
>  				drive->present = 0;
>  			}
>  		}
> +		ident_quirks(drive);
>  		/* drive was found */
>  	}
>  	if(!drive->present)
> 
> 
> Signed-off-by: Alan Cox
> 

This one is cause this:

---
  LD      .tmp_vmlinux1
drivers/built-in.o(.text+0x6ef1f): In function `ident_quirks':
: undefined reference to `__udivdi3'
make: *** [.tmp_vmlinux1] Error 1
---


Regards,

-- 
Martin Schlemmer

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: fixup incomplete ident blocks on ITE raid volumes
  2004-08-16 15:28   ` Alan Cox
@ 2004-08-16 14:57     ` Alan Cox
  0 siblings, 0 replies; 6+ messages in thread
From: Alan Cox @ 2004-08-16 14:57 UTC (permalink / raw)
  To: Alan Cox
  Cc: Bartlomiej Zolnierkiewicz, linux-ide, Linux Kernel Mailing List,
	torvalds

/sOn Llu, 2004-08-16 at 16:28, Alan Cox wrote:
> On Mon, Aug 16, 2004 at 05:16:35PM +0200, Bartlomiej Zolnierkiewicz wrote:
> > This should be part of ITE driver patch and be compiled only when ITE driver 
> > is going to be used or even better - there should be new callback for that.
> 
> Nice theory but doesn't work that way. The ITE drive will do this even if
> you don't have the ITE driver compiled in because it'll be seen as the
> mainboard legacy controller (or generic) in some systems.

By way of more explanation here. The ITE chip does some interesting
things. Its got two modes. The first is a generic nodescript and 
slightly irritatingly designed IDE device. The second runs stuff via an
onboard microcontroller which can do stuff like fire transactions up on
both busses and then do the DMA to both at once.

The firmware when you have raid volumes fakes up identity blocks (badly)
and the device is IDE class and capable of being your main IDE
controller. In that situation even the generic PIO driver will 
see the RAID volumes and get confused by the ident blocks.

There is a second problem too resulting from this. Not only might the
IT8212 module not be loaded, but even if it is we probe the generic IDE
devices with the generic PIO and then attach the PCI driver on top of
it. That one can be dealt with by using a little bit of care but the
fact generic IDE sees them I think means it has to be in the generic ide
probe code. A later patch removes the geometry stuff as I fixed that
properly in ide-disk so it isn't needed now.

Alan


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: fixup incomplete ident blocks on ITE raid volumes
  2004-08-15 14:45 PATCH: fixup incomplete ident blocks on ITE raid volumes Alan Cox
  2004-08-15 20:28 ` Martin Schlemmer
@ 2004-08-16 15:16 ` Bartlomiej Zolnierkiewicz
  2004-08-16 15:28   ` Alan Cox
  1 sibling, 1 reply; 6+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-08-16 15:16 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-ide, linux-kernel, torvalds


This should be part of ITE driver patch and be compiled only when ITE driver 
is going to be used or even better - there should be new callback for that.

On Sunday 15 August 2004 16:45, Alan Cox wrote:
> diff -u --new-file --recursive --exclude-from /usr/src/exclude
> linux.vanilla-2.6.8-rc3/drivers/ide/ide-probe.c
> linux-2.6.8-rc3/drivers/ide/ide-probe.c ---
> linux.vanilla-2.6.8-rc3/drivers/ide/ide-probe.c	2004-08-09
> 15:51:00.000000000 +0100 +++
> linux-2.6.8-rc3/drivers/ide/ide-probe.c	2004-08-14 21:03:03.000000000 +0100
> @@ -542,7 +542,51 @@
>  }
>
>  /**
> - *	probe_for_drives	-	upper level drive probe
> + *	ident_quirks	-	drive ident mangler
> + *	@drive: drive to check
> + *
> + *	Take the returned ident block for the drive and see if it
> + *	is one of the broken ones. We still broken ident fixups in
> + *	multiple places, we should migrate some of the others here.
> + */
> +static void ident_quirks(ide_drive_t *drive)
> +{
> +	struct hd_driveid *id = drive->id;
> +	u16 *idbits = (u16 *)id;
> +
> +	if(strstr(id->model, "Integrated Technology Express"))
> +	{
> +		/* IT821x raid volume with bogus ident block */
> +		if(id->lba_capacity >= 0x200000)
> +		{
> +			id->sectors = 63;
> +			id->heads = 255;
> +		}
> +		else
> +		{
> +			id->sectors = 32;
> +			id->heads = 64;
> +		}
> +		id->cyls = 1 + id->lba_capacity_2 / (id->heads * id->sectors);
> +		/* LBA28 is ok, DMA is ok, UDMA data is valid */
> +		id->capability |= 3;
> +		id->field_valid |= 7;
> +		/* LBA48 is ok */
> +		id->command_set_2 |= 0x0400;
> +		id->cfs_enable_2 |= 0x0400;
> +		/* Flush is ok */
> +		id->cfs_enable_2 |= 0x3000;
> +		printk(KERN_WARNING "%s: IT8212 %sRAID %d volume",
> +			drive->name,
> +			idbits[147] ? "Bootable ":"",
> +			idbits[129]);
> +		if(idbits[129] != 1)
> +			printk("(%dK stripe)", idbits[146]);
> +		printk(".\n");
> +	}
> +}
> +/**
> + *	probe_for_drive	-	upper level drive probe
>   *	@drive: drive to probe for
>   *
>   *	probe_for_drive() tests for existence of a given drive using do_probe()
> @@ -553,7 +597,7 @@
>   *			   still be 0)
>   */
>
> -static inline u8 probe_for_drive (ide_drive_t *drive)
> +static u8 probe_for_drive(ide_drive_t *drive)
>  {
>  	/*
>  	 *	In order to keep things simple we have an id
> @@ -602,6 +646,7 @@
>  				drive->present = 0;
>  			}
>  		}
> +		ident_quirks(drive);
>  		/* drive was found */
>  	}
>  	if(!drive->present)
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: fixup incomplete ident blocks on ITE raid volumes
  2004-08-16 15:16 ` Bartlomiej Zolnierkiewicz
@ 2004-08-16 15:28   ` Alan Cox
  2004-08-16 14:57     ` Alan Cox
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Cox @ 2004-08-16 15:28 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: Alan Cox, linux-ide, linux-kernel, torvalds

On Mon, Aug 16, 2004 at 05:16:35PM +0200, Bartlomiej Zolnierkiewicz wrote:
> This should be part of ITE driver patch and be compiled only when ITE driver 
> is going to be used or even better - there should be new callback for that.

Nice theory but doesn't work that way. The ITE drive will do this even if
you don't have the ITE driver compiled in because it'll be seen as the
mainboard legacy controller (or generic) in some systems.

Alan


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-08-16 16:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-15 14:45 PATCH: fixup incomplete ident blocks on ITE raid volumes Alan Cox
2004-08-15 20:28 ` Martin Schlemmer
2004-08-15 20:27   ` Alan Cox
2004-08-16 15:16 ` Bartlomiej Zolnierkiewicz
2004-08-16 15:28   ` Alan Cox
2004-08-16 14:57     ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).