public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* ali15x3 on alpha dies in 2.4.21-BK
@ 2002-12-06  2:20 Jeff Garzik
  2002-12-06 10:44 ` Ivan Kokshaysky
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Garzik @ 2002-12-06  2:20 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Alan Cox, andre, Marcelo Tosatti

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

IDE on this alpha ds10 is totally dead:

attached is the manually-transcribed console messages, patch I did to 
get it to build [thanks Alan], and the IDE section of my .config.

This alpha boots and runs just fine on stock 2.4.20.

[-- Attachment #2: alpha-ide-dead.txt --]
[-- Type: text/plain, Size: 1825 bytes --]

Uniform multi-platform eide driver revision: 7.00beta-2.4
ide: assuming 33mhz system buys speed for pio modes; override with idebus=xx
hda: compaq cdr-8435, atapi cd/dvd-rom drive
hdc: fujitsu mpd3108AT, ata disk drive
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
ide1 at 0x170-0x177,0x376 on irq 15
hdc: 19541088 sectors (10005 MB) w/ 512KiB cache, CHS=19386/16/63
hda: atapi 32x cd-rom driver, 128kB cache
uniform cd-rom driver revision: 3.12
partition check:
 hdc: hdc1 hdc2 hdc3
ali15x3: ide controller at PCI slot 00:0d.0
ali15x3: chipset revision 193
ali15x3: not 100% native mode, will probe irqs later
  ide0: bm-dma at 0x8420-0x8427, bios settings: hda:pio, hdb:pio
  ide1: bm-dma at 0x8428-0x842f, bios settings: hdc:pio, hdd:pio
hdc:hdc: status timeout: status=0xff {busy}

hdc: drive not ready for command

ide1:reset timed-out, status=0xff
hdc: status timeout: status=0xff {busy}
hdc: drive not ready for command
[...stuff scrolls off screen too fast to read...]
end_request: I/O error, dev 16:00 (hdc), sector 2
end_request: I/O error, dev 16:00 (hdc), sector 4
end_request: I/O error, dev 16:00 (hdc), sector 6
end_request: I/O error, dev 16:00 (hdc), sector 8
end_request: I/O error, dev 16:00 (hdc), sector 10
end_request: I/O error, dev 16:00 (hdc), sector 12
end_request: I/O error, dev 16:00 (hdc), sector 14
end_request: I/O error, dev 16:00 (hdc), sector 0
end_request: I/O error, dev 16:00 (hdc), sector 2
end_request: I/O error, dev 16:00 (hdc), sector 4
end_request: I/O error, dev 16:00 (hdc), sector 6
end_request: I/O error, dev 16:00 (hdc), sector 8
end_request: I/O error, dev 16:00 (hdc), sector 10
end_request: I/O error, dev 16:00 (hdc), sector 12
end_request: I/O error, dev 16:00 (hdc), sector 14
 unable to read partition table
[...continues with unrelated stuff, then panics due to no root fs...]

[-- Attachment #3: patch --]
[-- Type: text/plain, Size: 767 bytes --]

===== include/asm-alpha/system.h 1.4 vs edited =====
--- 1.4/include/asm-alpha/system.h	Tue Feb  5 02:49:34 2002
+++ edited/include/asm-alpha/system.h	Thu Dec  5 20:28:28 2002
@@ -310,11 +310,13 @@
 #define __save_flags(flags)	((flags) = rdps())
 #define __save_and_cli(flags)	do { (flags) = swpipl(IPL_MAX); barrier(); } while(0)
 #define __restore_flags(flags)	do { barrier(); setipl(flags); barrier(); } while(0)
+#define __save_and_sti(flags)   do { (flags) = swpipl(IPL_MIN); barrier(); } while(0)
 
 #define local_irq_save(flags)		__save_and_cli(flags)
 #define local_irq_restore(flags)	__restore_flags(flags)
 #define local_irq_disable()		__cli()
 #define local_irq_enable()		__sti()
+#define local_irq_set(flags)		__save_and_sti(flags)
 
 #ifdef CONFIG_SMP
 

[-- Attachment #4: alpha-config.txt --]
[-- Type: text/plain, Size: 2231 bytes --]

#
# ATA/IDE/MFM/RLL support
#
CONFIG_IDE=y

#
# IDE, ATA and ATAPI Block devices
#
CONFIG_BLK_DEV_IDE=y

#
# Please see Documentation/ide.txt for help/info on IDE drives
#
# CONFIG_BLK_DEV_HD_IDE is not set
# CONFIG_BLK_DEV_HD is not set
CONFIG_BLK_DEV_IDEDISK=y
# CONFIG_IDEDISK_MULTI_MODE is not set
CONFIG_IDEDISK_STROKE=y
# CONFIG_BLK_DEV_IDECS is not set
CONFIG_BLK_DEV_IDECD=y
# CONFIG_BLK_DEV_IDETAPE is not set
# CONFIG_BLK_DEV_IDEFLOPPY is not set
# CONFIG_BLK_DEV_IDESCSI is not set
CONFIG_IDE_TASK_IOCTL=y
CONFIG_IDE_TASKFILE_IO=y

#
# IDE chipset support/bugfixes
#
# CONFIG_BLK_DEV_CMD640 is not set
# CONFIG_BLK_DEV_CMD640_ENHANCED is not set
# CONFIG_BLK_DEV_ISAPNP is not set
CONFIG_BLK_DEV_IDEPCI=y
CONFIG_BLK_DEV_GENERIC=y
CONFIG_IDEPCI_SHARE_IRQ=y
CONFIG_BLK_DEV_IDEDMA_PCI=y
# CONFIG_BLK_DEV_OFFBOARD is not set
# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
CONFIG_IDEDMA_PCI_AUTO=y
# CONFIG_IDEDMA_ONLYDISK is not set
CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_IDEDMA_PCI_WIP is not set
CONFIG_BLK_DEV_ADMA=y
# CONFIG_BLK_DEV_AEC62XX is not set
CONFIG_BLK_DEV_ALI15X3=y
# CONFIG_WDC_ALI15X3 is not set
# CONFIG_BLK_DEV_AMD74XX is not set
# CONFIG_AMD74XX_OVERRIDE is not set
# CONFIG_BLK_DEV_CMD64X is not set
# CONFIG_BLK_DEV_CY82C693 is not set
# CONFIG_BLK_DEV_CS5530 is not set
# CONFIG_BLK_DEV_HPT34X is not set
# CONFIG_HPT34X_AUTODMA is not set
# CONFIG_BLK_DEV_HPT366 is not set
# CONFIG_BLK_DEV_PIIX is not set
# CONFIG_BLK_DEV_NFORCE is not set
# CONFIG_BLK_DEV_NS87415 is not set
# CONFIG_BLK_DEV_OPTI621 is not set
# CONFIG_BLK_DEV_PDC202XX_OLD is not set
# CONFIG_PDC202XX_BURST is not set
# CONFIG_BLK_DEV_PDC202XX_NEW is not set
# CONFIG_PDC202XX_FORCE is not set
# CONFIG_BLK_DEV_RZ1000 is not set
# CONFIG_BLK_DEV_SC1200 is not set
# CONFIG_BLK_DEV_SVWKS is not set
# CONFIG_BLK_DEV_SIIMAGE is not set
# CONFIG_BLK_DEV_SIS5513 is not set
# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
# CONFIG_IDE_CHIPSETS is not set
CONFIG_IDEDMA_AUTO=y
# CONFIG_IDEDMA_IVB is not set
# CONFIG_DMA_NONPCI is not set
CONFIG_BLK_DEV_IDE_MODES=y
# CONFIG_BLK_DEV_ATARAID is not set
# CONFIG_BLK_DEV_ATARAID_PDC is not set
# CONFIG_BLK_DEV_ATARAID_HPT is not set

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

* Re: ali15x3 on alpha dies in 2.4.21-BK
  2002-12-06  2:20 ali15x3 on alpha dies in 2.4.21-BK Jeff Garzik
@ 2002-12-06 10:44 ` Ivan Kokshaysky
  2002-12-06 19:51   ` Jeff Garzik
  0 siblings, 1 reply; 3+ messages in thread
From: Ivan Kokshaysky @ 2002-12-06 10:44 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Linux Kernel Mailing List, Alan Cox, andre, Marcelo Tosatti

On Thu, Dec 05, 2002 at 09:20:01PM -0500, Jeff Garzik wrote:
> ali15x3: not 100% native mode, will probe irqs later
>   ide0: bm-dma at 0x8420-0x8427, bios settings: hda:pio, hdb:pio
>   ide1: bm-dma at 0x8428-0x842f, bios settings: hdc:pio, hdd:pio
> hdc:hdc: status timeout: status=0xff {busy}

Fixed in 2.5-ac two months ago... ;-)

Well, in addition to true legacy and native modes, the ALi chip supports
"intermediate" one which is utterly broken wrt PCI spec.
In this mode
BAR0 = 0x1f1
BAR1 = 0x3f5
BAR2 = 0x171
BAR3 = 0x375

and these BARs are *read-only*. This causes a lot of confusion:
a) sizes calculated by pci_read_bases() for these IO ranges are
   incorrect;
b) generic resource allocation code assumes that these BARs
   can be reassigned, and this actually happens on Alpha.

As there are other PCI devices with the same problem, I prefer
generic solution instead of individual quirk routines.

Here's the patch re-diffed vs. 2.4.

Ivan.

--- 2.4bk/drivers/pci/pci.c	Fri Dec  6 11:07:52 2002
+++ linux/drivers/pci/pci.c	Fri Dec  6 11:09:23 2002
@@ -1039,13 +1039,20 @@ static inline unsigned int pci_calc_reso
 }
 
 /*
- * Find the extent of a PCI decode..
+ * Find the extent of a PCI decode, do sanity checks.
  */
-static u32 pci_size(u32 base, unsigned long mask)
+static u32 pci_size(u32 base, u32 maxbase, unsigned long mask)
 {
-	u32 size = mask & base;		/* Find the significant bits */
+	u32 size = mask & maxbase;	/* Find the significant bits */
+	if (!size)
+		return 0;
 	size = size & ~(size-1);	/* Get the lowest of them to find the decode size */
-	return size-1;			/* extent = size - 1 */
+	size -= 1;			/* extent = size - 1 */
+	if (base == maxbase && ((base | size) & mask) != mask)
+		return 0;		/* base == maxbase can be valid only
+					   if the BAR has been already
+					   programmed with all 1s */
+	return size;
 }
 
 static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
@@ -1068,13 +1075,17 @@ static void pci_read_bases(struct pci_de
 		if (l == 0xffffffff)
 			l = 0;
 		if ((l & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_MEMORY) {
+			sz = pci_size(l, sz, PCI_BASE_ADDRESS_MEM_MASK);
+			if (!sz)
+				continue;
 			res->start = l & PCI_BASE_ADDRESS_MEM_MASK;
 			res->flags |= l & ~PCI_BASE_ADDRESS_MEM_MASK;
-			sz = pci_size(sz, PCI_BASE_ADDRESS_MEM_MASK);
 		} else {
+			sz = pci_size(l, sz, PCI_BASE_ADDRESS_IO_MASK & 0xffff);
+			if (!sz)
+				continue;
 			res->start = l & PCI_BASE_ADDRESS_IO_MASK;
 			res->flags |= l & ~PCI_BASE_ADDRESS_IO_MASK;
-			sz = pci_size(sz, PCI_BASE_ADDRESS_IO_MASK & 0xffff);
 		}
 		res->end = res->start + (unsigned long) sz;
 		res->flags |= pci_calc_resource_flags(l);
@@ -1104,6 +1115,7 @@ static void pci_read_bases(struct pci_de
 	if (rom) {
 		dev->rom_base_reg = rom;
 		res = &dev->resource[PCI_ROM_RESOURCE];
+		res->name = dev->name;
 		pci_read_config_dword(dev, rom, &l);
 		pci_write_config_dword(dev, rom, ~PCI_ROM_ADDRESS_ENABLE);
 		pci_read_config_dword(dev, rom, &sz);
@@ -1111,13 +1123,14 @@ static void pci_read_bases(struct pci_de
 		if (l == 0xffffffff)
 			l = 0;
 		if (sz && sz != 0xffffffff) {
+			sz = pci_size(l, sz, PCI_ROM_ADDRESS_MASK);
+			if (!sz)
+				return;
 			res->flags = (l & PCI_ROM_ADDRESS_ENABLE) |
 			  IORESOURCE_MEM | IORESOURCE_PREFETCH | IORESOURCE_READONLY | IORESOURCE_CACHEABLE;
 			res->start = l & PCI_ROM_ADDRESS_MASK;
-			sz = pci_size(sz, PCI_ROM_ADDRESS_MASK);
 			res->end = res->start + (unsigned long) sz;
 		}
-		res->name = dev->name;
 	}
 }
 

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

* Re: ali15x3 on alpha dies in 2.4.21-BK
  2002-12-06 10:44 ` Ivan Kokshaysky
@ 2002-12-06 19:51   ` Jeff Garzik
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2002-12-06 19:51 UTC (permalink / raw)
  To: Alan Cox; +Cc: Ivan Kokshaysky, Linux Kernel Mailing List, andre,
	Marcelo Tosatti

Alan, et al.,

Ivan's patch does indeed fix alim15x3 IDE here, for 2.4.21-BK.

(you of course still need the include/asm-alpha/system.h patch I posted, 
too)


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

end of thread, other threads:[~2002-12-06 19:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-06  2:20 ali15x3 on alpha dies in 2.4.21-BK Jeff Garzik
2002-12-06 10:44 ` Ivan Kokshaysky
2002-12-06 19:51   ` Jeff Garzik

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