linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] adaptec 1210sa
@ 2003-12-22  2:05 Mickael Marchand
  2003-12-30 23:34 ` Jeff Garzik
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Mickael Marchand @ 2003-12-22  2:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jeff Garzik

[-- Attachment #1: Type: Text/Plain, Size: 703 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

reading linux-scsi I found a suggestion by Justin to make adaptec's 1210 sa 
working. I made the corresponding patch for libata, and it actually works :)

it needs  some redesign to only apply to aar1210 (as standard sil3112 does not 
need it) and I guess some testing before inclusion.

the idea suggested by Justin was to clear bits 6 and 7 at 0x8a of pci 
configuration space. (which I hope did fine :)

Thanks Justin :)

Cheers,
Mik
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/5lFoyOYzc4nQ8j0RAo9LAJ90CMeKb8wcE9ZgGULpUmep2wScdQCfYQ7B
fjiz1d2FE1+HTxFXSG2Pc6s=
=aott
-----END PGP SIGNATURE-----

[-- Attachment #2: aar1210sa.patch --]
[-- Type: text/x-diff, Size: 583 bytes --]

--- /usr/src/linux-2.6.0/drivers/scsi/sata_sil.c	2003-12-21 13:30:58.000000000 +0100
+++ linux-2.6.0/drivers/scsi/sata_sil.c	2003-12-22 02:46:32.000000000 +0100
@@ -276,6 +276,16 @@
 		goto err_out_regions;
 	}
 
+	//let's have fun
+	u8 v; 
+	pci_read_config_byte(pdev, 0x8a, &v);
+	int mask = 0x3f; //clear 6 and 7 bits
+	if (v & ~mask) {
+		printk("Reenabling interrupts because Adaptec's BIOS disables them\n" );
+		v &= mask;
+		pci_write_config_byte(pdev, 0x8a, v);
+	}
+
 	memset(probe_ent, 0, sizeof(*probe_ent));
 	INIT_LIST_HEAD(&probe_ent->node);
 	probe_ent->pdev = pdev;

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

* Re: [PATCH] adaptec 1210sa
  2003-12-22  2:05 [PATCH] adaptec 1210sa Mickael Marchand
@ 2003-12-30 23:34 ` Jeff Garzik
  2003-12-30 23:57   ` Justin T. Gibbs
  2003-12-31  0:10   ` Hugo Mills
  2003-12-30 23:51 ` Jeff Garzik
  2003-12-31  0:20 ` Jeff Garzik
  2 siblings, 2 replies; 9+ messages in thread
From: Jeff Garzik @ 2003-12-30 23:34 UTC (permalink / raw)
  To: Mickael Marchand; +Cc: linux-kernel

Mickael Marchand wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi,
> 
> reading linux-scsi I found a suggestion by Justin to make adaptec's 1210 sa 
> working. I made the corresponding patch for libata, and it actually works :)
> 
> it needs  some redesign to only apply to aar1210 (as standard sil3112 does not 
> need it) and I guess some testing before inclusion.
> 
> the idea suggested by Justin was to clear bits 6 and 7 at 0x8a of pci 
> configuration space. (which I hope did fine :)
> 
> Thanks Justin :)


Does the aar1210 have a different PCI id?  That would make it easy to 
distinguish, and thus easy to selectively apply your patch only to 
Adaptec chipsets that need it.

	Jeff




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

* Re: [PATCH] adaptec 1210sa
  2003-12-22  2:05 [PATCH] adaptec 1210sa Mickael Marchand
  2003-12-30 23:34 ` Jeff Garzik
@ 2003-12-30 23:51 ` Jeff Garzik
  2003-12-31  0:20 ` Jeff Garzik
  2 siblings, 0 replies; 9+ messages in thread
From: Jeff Garzik @ 2003-12-30 23:51 UTC (permalink / raw)
  To: Mickael Marchand; +Cc: linux-kernel, Bartlomiej Zolnierkiewicz

Mickael Marchand wrote:
> --- /usr/src/linux-2.6.0/drivers/scsi/sata_sil.c	2003-12-21 13:30:58.000000000 +0100
> +++ linux-2.6.0/drivers/scsi/sata_sil.c	2003-12-22 02:46:32.000000000 +0100
> @@ -276,6 +276,16 @@
>  		goto err_out_regions;
>  	}
>  
> +	//let's have fun
> +	u8 v; 
> +	pci_read_config_byte(pdev, 0x8a, &v);
> +	int mask = 0x3f; //clear 6 and 7 bits
> +	if (v & ~mask) {
> +		printk("Reenabling interrupts because Adaptec's BIOS disables them\n" );
> +		v &= mask;
> +		pci_write_config_byte(pdev, 0x8a, v);
> +	}
> +
>  	memset(probe_ent, 0, sizeof(*probe_ent));
>  	INIT_LIST_HEAD(&probe_ent->node);
>  	probe_ent->pdev = pdev;


Actually, ignore that last question.  The SII docs indicate these bits 
are present in the standard SII 3112 chip, so the driver should just 
make sure to do this unconditionally.

Bart, the above applies to siimage.c as well.  The following are equal:
* PCI config reg 0x8a (byte), bits 6/7
* PCI config reg 0x88 (dword), bits 22/23
* MMIO offset 0x48 (dword), bits 22/23

The lower bit masks IDE0 interrupts, and the higher bit masks IDE1 
interrupts.

	Jeff




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

* Re: [PATCH] adaptec 1210sa
  2003-12-30 23:57   ` Justin T. Gibbs
@ 2003-12-30 23:55     ` Jeff Garzik
  0 siblings, 0 replies; 9+ messages in thread
From: Jeff Garzik @ 2003-12-30 23:55 UTC (permalink / raw)
  To: Justin T. Gibbs; +Cc: Mickael Marchand, linux-kernel

Justin T. Gibbs wrote:
>>>the idea suggested by Justin was to clear bits 6 and 7 at 0x8a of pci 
>>>configuration space. (which I hope did fine :)
>>>
>>>Thanks Justin :)
>>
>>
>>Does the aar1210 have a different PCI id?  That would make it easy to
>>distinguish, and thus easy to selectively apply your patch only to Adaptec
>>chipsets that need it.
> 
> 
> The change is harmless for controllers using non-adaptec BIOSes.  You'll
> find that on these other controllers, the interrupt masks are already
> clear.  If this wasn't the case, the current Linux driver wouldn't work
> even on stock boards.


The current Linux driver (well, my sata_sil at least) doesn't work for 
several situations, at the moment :)  I need to handle the watchdog 
timer, and also need to mask a bunch of SATA-phy-specific interrupts.

Now that I see in the docs that these bits are present in the stock 
3112, it makes sense to unconditionally ensure they are clear, thus 
completely eliminating the BIOS from the equation.

	Jeff




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

* Re: [PATCH] adaptec 1210sa
  2003-12-30 23:34 ` Jeff Garzik
@ 2003-12-30 23:57   ` Justin T. Gibbs
  2003-12-30 23:55     ` Jeff Garzik
  2003-12-31  0:10   ` Hugo Mills
  1 sibling, 1 reply; 9+ messages in thread
From: Justin T. Gibbs @ 2003-12-30 23:57 UTC (permalink / raw)
  To: Jeff Garzik, Mickael Marchand; +Cc: linux-kernel

>> the idea suggested by Justin was to clear bits 6 and 7 at 0x8a of pci 
>> configuration space. (which I hope did fine :)
>> 
>> Thanks Justin :)
> 
> 
> Does the aar1210 have a different PCI id?  That would make it easy to
> distinguish, and thus easy to selectively apply your patch only to Adaptec
> chipsets that need it.

The change is harmless for controllers using non-adaptec BIOSes.  You'll
find that on these other controllers, the interrupt masks are already
clear.  If this wasn't the case, the current Linux driver wouldn't work
even on stock boards.

--
Justin


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

* Re: [PATCH] adaptec 1210sa
  2003-12-30 23:34 ` Jeff Garzik
  2003-12-30 23:57   ` Justin T. Gibbs
@ 2003-12-31  0:10   ` Hugo Mills
  1 sibling, 0 replies; 9+ messages in thread
From: Hugo Mills @ 2003-12-31  0:10 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Mickael Marchand, linux-kernel

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

On Tue, Dec 30, 2003 at 06:34:18PM -0500, Jeff Garzik wrote:
> Mickael Marchand wrote:
> >it needs  some redesign to only apply to aar1210 (as standard sil3112 does 
> >not need it) and I guess some testing before inclusion.
> >
> >the idea suggested by Justin was to clear bits 6 and 7 at 0x8a of pci 
> >configuration space. (which I hope did fine :)
> 
> Does the aar1210 have a different PCI id?  That would make it easy to 
> distinguish, and thus easy to selectively apply your patch only to 
> Adaptec chipsets that need it.

   It's not directly relevant, given the rest of this thread, but the
AAR-1210SA does have a different PCI ID to the standard SiI3112.

   Hugo.

-- 
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 1C335860 from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
   --- Anyone who claims their cryptographic protocol is secure is ---   
         either a genius or a fool.  Given the genius/fool ratio         
                 for our species,  the odds aren't good.                 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH] adaptec 1210sa
  2003-12-22  2:05 [PATCH] adaptec 1210sa Mickael Marchand
  2003-12-30 23:34 ` Jeff Garzik
  2003-12-30 23:51 ` Jeff Garzik
@ 2003-12-31  0:20 ` Jeff Garzik
  2003-12-31 11:25   ` Mickael Marchand
  2004-01-03 20:46   ` Mickael Marchand
  2 siblings, 2 replies; 9+ messages in thread
From: Jeff Garzik @ 2003-12-31  0:20 UTC (permalink / raw)
  To: Mickael Marchand
  Cc: linux-kernel, Bartlomiej Zolnierkiewicz, Justin T. Gibbs, Hugo Mills

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

Mickael Marchand wrote:
> reading linux-scsi I found a suggestion by Justin to make adaptec's 1210 sa 
> working. I made the corresponding patch for libata, and it actually works :)
> 
> it needs  some redesign to only apply to aar1210 (as standard sil3112 does not 
> need it) and I guess some testing before inclusion.


Here is the patch I'm applying.  Please test and let me know how it goes.

Also, someone please send me a patch for the PCI ids :)

	Jeff



[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1033 bytes --]

===== drivers/scsi/sata_sil.c 1.3 vs edited =====
--- 1.3/drivers/scsi/sata_sil.c	Tue Dec 16 19:16:55 2003
+++ edited/drivers/scsi/sata_sil.c	Tue Dec 30 19:11:02 2003
@@ -40,6 +40,10 @@
 enum {
 	sil_3112		= 0,
 
+	SIL_SYSCFG		= 0x48,
+	SIL_MASK_IDE0_INT	= (1 << 22),
+	SIL_MASK_IDE1_INT	= (1 << 23),
+
 	SIL_IDE0_TF		= 0x80,
 	SIL_IDE0_CTL		= 0x8A,
 	SIL_IDE0_BMDMA		= 0x00,
@@ -236,6 +240,7 @@
 	unsigned long base;
 	void *mmio_base;
 	int rc;
+	u32 tmp;
 
 	if (!printed_version++)
 		printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n");
@@ -295,6 +300,14 @@
 	probe_ent->port[1].bmdma_addr = base + SIL_IDE1_BMDMA;
 	probe_ent->port[1].scr_addr = base + SIL_IDE1_SCR;
 	ata_std_ports(&probe_ent->port[1]);
+
+	/* make sure IDE0/1 interrupts are not masked */
+	tmp = readl(mmio_base + SIL_SYSCFG);
+	if (tmp & (SIL_MASK_IDE0_INT | SIL_MASK_IDE1_INT)) {
+		tmp &= ~(SIL_MASK_IDE0_INT | SIL_MASK_IDE1_INT);
+		writel(tmp, mmio_base + SIL_SYSCFG);
+		readl(mmio_base + SIL_SYSCFG);	/* flush */
+	}
 
 	pci_set_master(pdev);
 

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

* Re: [PATCH] adaptec 1210sa
  2003-12-31  0:20 ` Jeff Garzik
@ 2003-12-31 11:25   ` Mickael Marchand
  2004-01-03 20:46   ` Mickael Marchand
  1 sibling, 0 replies; 9+ messages in thread
From: Mickael Marchand @ 2003-12-31 11:25 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: linux-kernel, Bartlomiej Zolnierkiewicz, Justin T. Gibbs, Hugo Mills

[-- Attachment #1: Type: Text/Plain, Size: 1003 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I can't test atm, I will test it in a few days.

here is the patch I used (the previous one was incomplete - diffed against the 
wrong file-), it includes the PCI ids you need.

Cheers,
Mik

Le Wednesday 31 December 2003 01:20, vous avez écrit :
> Mickael Marchand wrote:
> > reading linux-scsi I found a suggestion by Justin to make adaptec's 1210
> > sa working. I made the corresponding patch for libata, and it actually
> > works :)
> >
> > it needs  some redesign to only apply to aar1210 (as standard sil3112
> > does not need it) and I guess some testing before inclusion.
>
> Here is the patch I'm applying.  Please test and let me know how it goes.
>
> Also, someone please send me a patch for the PCI ids :)
>
> 	Jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/8rI2yOYzc4nQ8j0RAkLnAJ9PuvWKuQNTszOEajMBOKrDiR1WiwCaA2Wl
ASO6sogwJ696le2lvrwZyhI=
=bLBK
-----END PGP SIGNATURE-----

[-- Attachment #2: aar1210sa.diff --]
[-- Type: text/x-diff, Size: 1278 bytes --]

--- linux-2.4.23/drivers/scsi/sata_sil.c	2003-12-31 12:22:36.000000000 +0100
+++ linux-2.4.23.moria/drivers/scsi/sata_sil.c	2003-12-22 12:03:57.000000000 +0100
@@ -39,6 +39,7 @@
 
 enum {
 	sil_3112		= 0,
+	aar1210sa		= 1,
 
 	SIL_IDE0_TF		= 0x80,
 	SIL_IDE0_CTL		= 0x8A,
@@ -62,6 +63,7 @@
 
 static struct pci_device_id sil_pci_tbl[] = {
 	{ 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 },
+	{ 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, aar1210sa },
 	{ }	/* terminate list */
 };
 
@@ -122,6 +124,15 @@
 		.udma_mask	= 0x7f,			/* udma0-6; FIXME */
 		.port_ops	= &sil_ops,
 	},
+	/* aar1210sa */
+	{
+		.sht		= &sil_sht,
+		.host_flags	= ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
+				  ATA_FLAG_SRST | ATA_FLAG_MMIO,
+		.pio_mask	= 0x03,			/* pio3-4 */
+		.udma_mask	= 0x7f,			/* udma0-6; FIXME */
+		.port_ops	= &sil_ops,
+	},
 };
 
 MODULE_AUTHOR("Jeff Garzik");
@@ -263,6 +274,15 @@
 		goto err_out_regions;
 	}
 
+	u8 v;
+	pci_read_config_byte(pdev, 0x8a, &v);
+	int mask = 0x3f; //clear 6 and 7 bits
+	if (v & ~mask) {
+		printk("Reenabling interrupts because Adaptec's BIOS disables them\n" );
+		v &= mask;
+		pci_write_config_byte(pdev, 0x8a, v);
+	}
+
 	memset(probe_ent, 0, sizeof(*probe_ent));
 	INIT_LIST_HEAD(&probe_ent->node);
 	probe_ent->pdev = pdev;

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

* Re: [PATCH] adaptec 1210sa
  2003-12-31  0:20 ` Jeff Garzik
  2003-12-31 11:25   ` Mickael Marchand
@ 2004-01-03 20:46   ` Mickael Marchand
  1 sibling, 0 replies; 9+ messages in thread
From: Mickael Marchand @ 2004-01-03 20:46 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: linux-kernel, Bartlomiej Zolnierkiewicz, Justin T. Gibbs, Hugo Mills

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

this patch works fine on my box (with a soft raid1 array on top of it)

Cheers,
Mik

Le Wednesday 31 December 2003 01:20, vous avez écrit :
> Mickael Marchand wrote:
> > reading linux-scsi I found a suggestion by Justin to make adaptec's 1210
> > sa working. I made the corresponding patch for libata, and it actually
> > works :)
> >
> > it needs  some redesign to only apply to aar1210 (as standard sil3112
> > does not need it) and I guess some testing before inclusion.
>
> Here is the patch I'm applying.  Please test and let me know how it goes.
>
> Also, someone please send me a patch for the PCI ids :)
>
> 	Jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQE/9yoeyOYzc4nQ8j0RAlCkAJ9lr1ZIJqa5JTD/R7ELCvtP/Wn5WwCfQqzn
GEwV9zLRSQLpR8XY7Q4fzgk=
=w5Ft
-----END PGP SIGNATURE-----

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

end of thread, other threads:[~2004-01-03 20:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-22  2:05 [PATCH] adaptec 1210sa Mickael Marchand
2003-12-30 23:34 ` Jeff Garzik
2003-12-30 23:57   ` Justin T. Gibbs
2003-12-30 23:55     ` Jeff Garzik
2003-12-31  0:10   ` Hugo Mills
2003-12-30 23:51 ` Jeff Garzik
2003-12-31  0:20 ` Jeff Garzik
2003-12-31 11:25   ` Mickael Marchand
2004-01-03 20:46   ` Mickael Marchand

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).