public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch]back ports ICH3M support into 2.4.20
@ 2002-12-01  5:04 hugang
  2002-12-01 18:03 ` Alan Cox
  0 siblings, 1 reply; 4+ messages in thread
From: hugang @ 2002-12-01  5:04 UTC (permalink / raw)
  To: linux-kernel, Andrea Arcangeli, J.A. Magallon, Marcelo Tosatti

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

hello 
  Here is a back port patch for Intel ICH3M IDE support. It's more stable for me. Hope can merage into stable tree. thanks.


-- 
		- Hu Gang

[-- Attachment #2: misc_tune --]
[-- Type: application/octet-stream, Size: 2295 bytes --]

diff -u 2.4/drivers/ide/ide-pci.c:1.1.1.5 2.4/drivers/ide/ide-pci.c:1.1.1.5.8.2
--- 2.4/drivers/ide/ide-pci.c:1.1.1.5	Fri Nov 29 13:57:33 2002
+++ 2.4/drivers/ide/ide-pci.c	Sun Dec  1 12:50:44 2002
@@ -964,6 +964,41 @@
 	ide_setup_pci_device(dev2, d2);
 }
 
+inline void ide_register_xp_fix(struct pci_dev *dev)
+{
+        int i;
+        unsigned short cmd;
+        unsigned long flags;
+        unsigned long base_address[4] = { 0x1f0, 0x3f4, 0x170, 0x374 };
+	
+        local_irq_save(flags);
+        pci_read_config_word(dev, PCI_COMMAND, &cmd);
+        pci_write_config_word(dev, PCI_COMMAND, cmd & ~PCI_COMMAND_IO);
+        for (i=0; i<4; i++) {
+                dev->resource[i].start = 0;
+                dev->resource[i].end = 0;
+                dev->resource[i].flags = 0;
+        }                                                                        
+        for (i=0; i<4; i++) {                                                    
+                dev->resource[i].start = base_address[i];
+                dev->resource[i].flags |= PCI_BASE_ADDRESS_SPACE_IO;
+                pci_write_config_dword(dev,
+				       (PCI_BASE_ADDRESS_0 + (i * 4)),
+				       dev->resource[i].start);
+        }
+        pci_write_config_word(dev, PCI_COMMAND, cmd);
+        local_irq_restore(flags);
+}
+
+void __init fixup_device_piix (struct pci_dev *dev, ide_pci_device_t *d)
+{
+        if (dev->resource[0].start != 0x01F1)
+                ide_register_xp_fix(dev);
+        printk("%s: IDE controller on PCI bus %02x dev %02x\n",
+	       d->name, dev->bus->number, dev->devfn);
+        ide_setup_pci_device(dev, d);
+}
+
 /*
  * ide_scan_pcibus() gets invoked at boot time from ide.c.
  * It finds all PCI IDE controllers and calls ide_setup_pci_device for them.
@@ -990,6 +1025,8 @@
 		hpt366_device_order_fixup(dev, d);
 	else if (IDE_PCI_DEVID_EQ(d->devid, DEVID_PDC20270))
 		pdc20270_device_order_fixup(dev, d);
+        else if (IDE_PCI_DEVID_EQ(d->devid, DEVID_ICH3M))
+                fixup_device_piix(dev, d);
 	else if (!IDE_PCI_DEVID_EQ(d->devid, IDE_PCI_DEVID_NULL) || (dev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
 		if (IDE_PCI_DEVID_EQ(d->devid, IDE_PCI_DEVID_NULL))
 			printk("%s: unknown IDE controller on PCI bus %02x device %02x, VID=%04x, DID=%04x\n",

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

* Re: [patch]back ports ICH3M support into 2.4.20
  2002-12-01  5:04 [patch]back ports ICH3M support into 2.4.20 hugang
@ 2002-12-01 18:03 ` Alan Cox
  2002-12-04 13:09   ` hugang
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Cox @ 2002-12-01 18:03 UTC (permalink / raw)
  To: hugang
  Cc: Linux Kernel Mailing List, Andrea Arcangeli, J.A. Magallon,
	Marcelo Tosatti

On Sun, 2002-12-01 at 05:04, hugang wrote:
> hello 
>   Here is a back port patch for Intel ICH3M IDE 

2.4.20 already has the correct version of the fixes for partially
configured IDE devices. The code you are posting is old and in several
places wrong, hence it was removed.

2.4.20 will try and do a full pci device setup, then fall back to just
configuring BAR4.

Alan


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

* Re: [patch]back ports ICH3M support into 2.4.20
  2002-12-01 18:03 ` Alan Cox
@ 2002-12-04 13:09   ` hugang
  2002-12-04 14:36     ` Alan Cox
  0 siblings, 1 reply; 4+ messages in thread
From: hugang @ 2002-12-04 13:09 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel, andrea, jamagallon, marcelo


[-- Attachment #1.1: Type: text/plain, Size: 1975 bytes --]

On 01 Dec 2002 18:03:25 +0000
Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:

> On Sun, 2002-12-01 at 05:04, hugang wrote:
> > hello 
> >   Here is a back port patch for Intel ICH3M IDE 
> 
> 2.4.20 already has the correct version of the fixes for partially
> configured IDE devices. The code you are posting is old and in several
> places wrong, hence it was removed.
> 
> 2.4.20 will try and do a full pci device setup, then fall back to just
> configuring BAR4.
> 
> Alan
> 
Here is an new patch for it. But I'm not true that , Place the fixup function in pci_init_piix is good way. But it works.
Here is it.
Index: 2.4/drivers/ide/piix.c
diff -u 2.4/drivers/ide/piix.c:1.1.1.4 2.4/drivers/ide/piix.c:1.1.1.4.8.3
--- 2.4/drivers/ide/piix.c:1.1.1.4	Fri Nov 29 13:57:34 2002
+++ 2.4/drivers/ide/piix.c	Wed Dec  4 21:05:27 2002
@@ -480,6 +480,30 @@
 }
 #endif /* defined(CONFIG_BLK_DEV_IDEDMA) && (CONFIG_PIIX_TUNING) */
 
+inline void ide_register_xp_fix(struct pci_dev *dev)
+{
+	int i;
+	unsigned short cmd;
+	unsigned long flags;
+	unsigned long base_address[4] = { 0x1f0, 0x3f4, 0x170, 0x374 };
+  
+	printk(KERN_INFO "PIIX: fixup IDE controller\n");
+	local_irq_save(flags);
+	pci_read_config_word(dev, PCI_COMMAND, &cmd);
+	write_config_word(dev, PCI_COMMAND, cmd & ~PCI_COMMAND_IO);
+
+	for (i=0; i<4; i++) {
+		dev->resource[i].start = base_address[i];
+		dev->resource[i].flags |= PCI_BASE_ADDRESS_SPACE_IO;
+		pci_write_config_dword(dev,
+				       (PCI_BASE_ADDRESS_0 + (i * 4)),
+				       dev->resource[i].start);
+	}
+
+	pci_write_config_word(dev, PCI_COMMAND, cmd);
+	local_irq_restore(flags);
+}
+
 unsigned int __init pci_init_piix (struct pci_dev *dev, const char *name)
 {
 #if defined(DISPLAY_PIIX_TIMINGS) && defined(CONFIG_PROC_FS)
@@ -489,6 +513,9 @@
 		piix_display_info = &piix_get_info;
 	}
 #endif /* DISPLAY_PIIX_TIMINGS && CONFIG_PROC_FS */
+	if (dev->resource[0].start != 0x01f1)
+		ide_register_xp_fix(dev);
+
 	return 0;
 }
 


-- 
		- Hu Gang

[-- Attachment #1.2: tune.gz --]
[-- Type: application/octet-stream, Size: 699 bytes --]

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

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

* Re: [patch]back ports ICH3M support into 2.4.20
  2002-12-04 13:09   ` hugang
@ 2002-12-04 14:36     ` Alan Cox
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Cox @ 2002-12-04 14:36 UTC (permalink / raw)
  To: hugang; +Cc: Linux Kernel Mailing List, andrea, jamagallon, marcelo

On Wed, 2002-12-04 at 13:09, hugang wrote:
> > 2.4.20 already has the correct version of the fixes for partially
> > configured IDE devices. The code you are posting is old and in several
> > places wrong, hence it was removed.
> > 
> > 2.4.20 will try and do a full pci device setup, then fall back to just
> > configuring BAR4.
> > 
> > Alan
> > 
> Here is an new patch for it. But I'm not true that , Place the fixup function in pci_init_piix is good way. But it works.
> Here is it.

See what I said before. 2.4.20 already does a pci BAR4 fixup if needed.
Your change is still wrong.



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

end of thread, other threads:[~2002-12-04 13:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-01  5:04 [patch]back ports ICH3M support into 2.4.20 hugang
2002-12-01 18:03 ` Alan Cox
2002-12-04 13:09   ` hugang
2002-12-04 14:36     ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox