From rowi@peanuts.homeunix.org  Thu Oct 23 10:27:31 2003
Return-Path: <rowi@peanuts.homeunix.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id D5CFB16A4B3
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 23 Oct 2003 10:27:31 -0700 (PDT)
Received: from peanuts.homeunix.org (pD953B373.dip.t-dialin.net [217.83.179.115])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 75CD943F85
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 23 Oct 2003 10:27:30 -0700 (PDT)
	(envelope-from rowi@peanuts.homeunix.org)
Received: from peanuts.homeunix.org (localhost [127.0.0.1])
	by peanuts.homeunix.org (8.12.9p2/8.12.9) with ESMTP id h9NHRSv2082839
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 23 Oct 2003 19:27:28 +0200 (CEST)
	(envelope-from rowi@peanuts.homeunix.org)
Received: (from root@localhost)
	by peanuts.homeunix.org (8.12.9p2/8.12.9/Submit) id h9NHRMvN082838;
	Thu, 23 Oct 2003 19:27:22 +0200 (CEST)
	(envelope-from rowi)
Message-Id: <200310231727.h9NHRMvN082838@peanuts.homeunix.org>
Date: Thu, 23 Oct 2003 19:27:22 +0200 (CEST)
From: Rolf Witt <rowi@peanuts.homeunix.org>
Reply-To: Rolf Witt <rowi@peanuts.homeunix.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: ATAPI-CDROM DMA Support on ALi Aladdin V Chipset is brocken
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         58458
>Category:       i386
>Synopsis:       [ata] ATAPI-CDROM DMA Support on ALi Aladdin V Chipset is broken (regression)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-i386
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct 23 10:30:20 PDT 2003
>Closed-Date:    Thu Jan 05 00:04:50 GMT 2006
>Last-Modified:  Thu Jan 05 00:04:50 GMT 2006
>Originator:     Rolf Witt
>Release:        FreeBSD 4.9-RC i386
>Organization:
>Environment:
System: FreeBSD peanuts.homeunix.org 4.9-RC FreeBSD 4.9-RC #1: Thu Oct 23 14:24:55 CEST 2003 rowi@peanuts.homeunix.org:/usr/obj/usr/src/sys/PEANUTS i386


Copyright (c) 1992-2003 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD 4.9-RC #1: Thu Oct 23 14:24:55 CEST 2003
    rowi@peanuts.homeunix.org:/usr/obj/usr/src/sys/PEANUTS
Timecounter "i8254"  frequency 1193182 Hz
Timecounter "TSC"  frequency 400911232 Hz
CPU: AMD-K6(tm) 3D+ Processor (400.91-MHz 586-class CPU)
  Origin = "AuthenticAMD"  Id = 0x591  Stepping = 1
  Features=0x8021bf<FPU,VME,DE,PSE,TSC,MSR,MCE,CX8,PGE,MMX>
  AMD Features=0x80000800<SYSCALL,3DNow!>
real memory  = 268369920 (262080K bytes)
avail memory = 256765952 (250748K bytes)
Preloaded elf kernel "kernel" at 0xc0449000.
VESA: v2.0, 8192k memory, flags:0x1, mode table:0xc00c69c9 (c00069c9)
VESA: Matrox Graphics Inc.
K6-family MTRR support enabled (2 registers)
md0: Malloc disk
Using $PIR table, 8 entries at 0xc00fdef0
npx0: <math processor> on motherboard
npx0: INT 16 interface
pcib0: <AcerLabs M1541 (Aladdin-V) PCI host bridge> on motherboard
pci0: <PCI bus> on pcib0
agp0: <Ali M1541 host to AGP bridge> mem 0xe0000000-0xe3ffffff at device 0.0 on pci0
pcib1: <AcerLabs M5243 PCI-PCI bridge> at device 1.0 on pci0
pci1: <PCI bus> on pcib1
drm0: <Matrox G200 (AGP)> mem 0xe5000000-0xe57fffff,0xe4000000-0xe4003fff,0xe8000000-0xe8ffffff irq 10 at device 0.0 on pci1
info: [drm] AGP at 0xe0000000 64MB
info: [drm] Initialized mga 3.1.0 20021029 on minor 0
pci0: <AcerLabs M5237 (Aladdin-V) USB controller> at 2.0 irq 11
isab0: <AcerLabs M1533 portable PCI-ISA bridge> at device 7.0 on pci0
isa0: <ISA bus> on isab0
ahc0: <Adaptec 2940 Ultra SCSI adapter> port 0xc000-0xc0ff mem 0xec002000-0xec002fff irq 10 at device 8.0 on pci0
aic7880: Ultra Single Channel A, SCSI Id=7, 16/253 SCBs
ifpi0: <AVM Fritz!Card PCI> port 0xc400-0xc41f mem 0xec000000-0xec00001f irq 5 at device 9.0 on pci0
ifpi0: ISAC 2085 Version A1/A2 or 2086/2186 Version 1.1 (IOM-2)
ifpi0: passive stack unit 0
xl0: <3Com 3c905C-TX Fast Etherlink XL> port 0xc800-0xc87f mem 0xec001000-0xec00107f irq 9 at device 10.0 on pci0
xl0: Ethernet address: 00:01:02:a6:59:59
miibus0: <MII bus> on xl0
xlphy0: <3c905C 10/100 internal PHY> on miibus0
xlphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
xl1: <3Com 3c905C-TX Fast Etherlink XL> port 0xcc00-0xcc7f mem 0xec003000-0xec00307f irq 9 at device 11.0 on pci0
xl1: Ethernet address: 00:01:02:b6:53:81
miibus1: <MII bus> on xl1
xlphy1: <3c905C 10/100 internal PHY> on miibus1
xlphy1:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
pcm0: <ESS Solo-1E> port 0xe000-0xe003,0xdc00-0xdc03,0xd800-0xd80f,0xd400-0xd40f,0xd000-0xd03f irq 10 at device 12.0 on pci0
atapci0: <AcerLabs Aladdin ATA66 controller> port 0xf000-0xf00f irq 0 at device 15.0 on pci0
ata0: at 0x1f0 irq 14 on atapci0
ata1: at 0x170 irq 15 on atapci0
orm0: <Option ROMs> at iomem 0xc0000-0xc7fff,0xc8000-0xc87ff on isa0
pmtimer0 on isa0
fdc0: <NEC 72065B or clone> at port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on isa0
fdc0: FIFO enabled, 8 bytes threshold
fd0: <1440-KB 3.5" drive> on fdc0 drive 0
atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: model Generic PS/2 mouse, device ID 0
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
sc0: <System console> on isa0
sc0: VGA <16 virtual consoles, flags=0x200>
sio0 at port 0x3f8-0x3ff irq 4 flags 0x10 on isa0
sio0: type 16550A
sio1 at port 0x2f8-0x2ff irq 3 on isa0
sio1: type 16550A
ppc0: <Parallel port> at port 0x378-0x37f irq 7 on isa0
ppc0: SMC-like chipset (ECP/EPP/PS2/NIBBLE) in COMPATIBLE mode
ppc0: FIFO with 16/16/1 bytes threshold
lpt0: <Printer> on ppbus0
lpt0: Interrupt-driven port
i4btel: 2 ISDN telephony interface device(s) attached
i4brbch: 4 raw B channel access device(s) attached
DUMMYNET initialized (011031)
IP packet filtering initialized, divert enabled, rule-based forwarding enabled, default to accept, logging limited to 100 packets/entry by default
i4bipr: 4 IP over raw HDLC ISDN device(s) attached (VJ header compression)
i4bctl: ISDN system control port attached
i4btrc: 4 ISDN trace device(s) attached
i4bisppp: 4 ISDN SyncPPP device(s) attached
i4b: ISDN call control device attached
ad0: 6197MB <IBM-DHEA-36481> [12592/16/63] at ata0-master UDMA33
ad1: 1222MB <QUANTUM FIREBALL1280A> [2484/16/63] at ata0-slave WDMA2
acd0: DVD-ROM <Pioneer DVD-ROM ATAPIModel DVD-104S 0206> at ata1-master PIO4
Mounting root from ufs:/dev/ad0s1a
da0 at ahc0 bus 0 target 0 lun 0
da0: <SyQuest SQ5200C A24> Removable Direct Access SCSI-2 device 
da0: 5.000MB/s transfers (5.000MHz, offset 15)
da0: 190MB (390696 512 byte sectors: 64H 32S/T 190C)
cd1 at ata1 bus 0 target 0 lun 0
cd1: <PIONEER DVD-ROM DVD-104 2.06> Removable CD-ROM SCSI-0 device 
cd1: 16.000MB/s transfers
cd1: Attempt to query device size failed: NOT READY, Medium not present
cd0 at ahc0 bus 0 target 1 lun 0
cd0: <TOSHIBA CD-ROM XM-6401TA 1002> Removable CD-ROM SCSI-2 device 
cd0: 20.000MB/s transfers (20.000MHz, offset 15)
cd0: Attempt to query device size failed: NOT READY, Medium not present
ohci0: <AcerLabs M5237 (Aladdin-V) USB controller> mem 0xec004000-0xec004fff irq 11 at device 2.0 on pci0
usb0: OHCI version 1.0, legacy support
usb0: <AcerLabs M5237 (Aladdin-V) USB controller> on ohci0
usb0: USB revision 1.0
uhub0: AcerLabs OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
acd0: READ_BIG - NO SENSE asc=0x00 ascq=0x00 error=0x00
acd0: READ_BIG - NO SENSE asc=0x00 ascq=0x00 error=0x00
cd9660: Joliet Extension (Level 1)


Buildworld with Sources from 22.10.2003

>Description:
If DMA on IDE-Channel 1 Device 0 aktiv, the DVD-ROM Drive no more works.
Only PIO works. I have testet this with 2 Drive (both have UDMA33 ability).
On Pre 4.8 Releases it still functioned. 

>How-To-Repeat:

atacontrol mode 1 UDMA33 BIOSDMA
mount_cd9660 /dev/acd0c /cdrom


>Fix:

	


>Release-Note:
>Audit-Trail:

From: Bruce Evans <bde@zeta.org.au>
To: Rolf Witt <rowi@peanuts.homeunix.org>
Cc: FreeBSD-gnats-submit@FreeBSD.org, freebsd-i386@FreeBSD.org
Subject: Re: i386/58458: ATAPI-CDROM DMA Support on ALi Aladdin V Chipset is
 brocken
Date: Fri, 24 Oct 2003 15:28:15 +1000 (EST)

 On Thu, 23 Oct 2003, Rolf Witt wrote:
 
 > >Description:
 > If DMA on IDE-Channel 1 Device 0 aktiv, the DVD-ROM Drive no more works.
 > Only PIO works. I have testet this with 2 Drive (both have UDMA33 ability).
 > On Pre 4.8 Releases it still functioned.
 
 I forwarded the following usenet article to the author of the bug, but
 received no reply.
 
 % Date: Mon, 13 Oct 2003 08:07:01 +0000 (UTC)
 % From: viro@parcelfarce.linux.theplanet.co.uk
 % Newsgroups: comp.unix.bsd.freebsd.misc
 % Subject: Re: Linux vs. FreeBSD (supportability)
 %
 % In article <3f8a362c$1_2@corp.newsgroups.com>,
 % Donn Miller  <dmmiller@cvzoom.net> wrote:
 %
 % >I've had problems with filesystem corruption with both ext2 and ext3,
 % >but never ext3.
 %
 % <shrug>  Count the bug reports and see.  Most of the cases of fs corruption
 % turn out to be either random memory corruption or breakage in underlying
 % block device driver.  Neither of those cares about fs type, obviously.
 %
 % If you have real cases of ext2 corruption (not of these two classes and not
 % "I had a dirty shutdown and fsck complained about something, I don't remember
 % what") - post a bug report.
 %
 % >  I think ext2 is the most crude and cruddy hack of a
 % >filesystem ever created.  ReiserFS is clearly the best filesystem for
 % >Linux right now.
 %
 % <raised brows>
 %
 % >Sounds like he must've been compiling his world and kernel with -O3
 % >-fomit-frame-pointer -fthread-jumps -funroll-all-loops
 % >-fstrength-reduce again.  Believe it or not, the default Gentoo
 % >optimization flags were along the same lines at one time.  The Linux
 % >kernel seemed more forgiving in the past of such idiotic optimization
 % >levels, but I think he might be getting "more lucky" with Linux in such
 % >a situation.  Even knowledgeable Linux people will advise against
 % >building the kernel with such insane optimizations.
 %
 % FWIW, that sort of bugs tend to boil down to missing memory barrier or
 % missing lock.  Not that gcc was too tolerant to anything past -O2, but
 % more often than not the real problem is in the code.  BTDT...
 %
 % Idiocy happens.  Case in point: while digging through ata-dma.c in 4.9-RC
 % a couple of hours ago, I've found the following gem:
 %
 %             switch(ATA_PIO0 + apiomode) {
 %             case ATA_PIO0: timing = 0x006d0003;
 %             case ATA_PIO1: timing = 0x00580002;
 %             case ATA_PIO2: timing = 0x00440001;
 %             case ATA_PIO3: timing = 0x00330001;
 %             case ATA_PIO4: timing = 0x00310001;
 %             default:       timing = 0x006d0003;
 %             }
 %
 % (M5229 support, in case you wonder and no, -CURRENT doesn't have that bug).
 % Had been there for quite a while and that's exactly the sort of bug that
 % is harder to find.  I'd seen equivalents blamed on compiler, OS, hardware,
 % admin, yadda, yadda.  Usually ends up with massive blushing when you
 % finally realize that yes, it was _that_ dumb...
 %
 %
 
 Bruce

From: Rolf Witt <rowi@free.de>
To: freebsd-gnats-submit@FreeBSD.org, rowi@free.de
Cc:  
Subject: Re: i386/58458: ATAPI-CDROM DMA Support on ALi Aladdin V Chipset
 is brocken
Date: Fri, 24 Oct 2003 11:19:01 +0200

 Nice text...
 
 I hope, i have you understand.
 
 I doesn't use wild gcc optimization flags.
  From my make.conf
 CFLAGS= -O -pipe
 COPTFLAGS= -O -pipe
 
 I believe that someone forgot the Workarounds for the DMA mode with CD- 
 Roms drive assemblies in the code. The Aladdin V chipsets has there a 
 problem.
 
 Thank you
 Rolf
 

From: Bruce Evans <bde@zeta.org.au>
To: Rolf Witt <rowi@free.de>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: i386/58458: ATAPI-CDROM DMA Support on ALi Aladdin V Chipset is
 brocken
Date: Fri, 24 Oct 2003 22:19:44 +1000 (EST)

 On Fri, 24 Oct 2003, Rolf Witt wrote:
 
 > The following reply was made to PR i386/58458; it has been noted by GNATS.
 >
 > From: Rolf Witt <rowi@free.de>
 >
 >  Nice text...
 >
 >  I hope, i have you understand.
 >
 >  I doesn't use wild gcc optimization flags.
 
 Er, it was about missing break statements.
 
 However, on closer inspection the missing break statements only affect
 PIO modes (at best, all PIO modes are reduced to PIO0).
 
 >  I believe that someone forgot the Workarounds for the DMA mode with CD-
 >  Roms drive assemblies in the code. The Aladdin V chipsets has there a
 >  problem.
 
 There seems to be only 1 significant change (an addition with no removals)
 between RELENG_4_8_0_RELEASE and RELENG_4_9 for Aladdin IV/V chipsets for
 DMA modes:
 
 %%%
 Index: ata-dma.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/dev/ata/ata-dma.c,v
 retrieving revision 1.35.2.29
 retrieving revision 1.35.2.34
 diff -u -2 -r1.35.2.29 -r1.35.2.34
 --- ata-dma.c	2 Oct 2002 14:13:38 -0000	1.35.2.29
 +++ ata-dma.c	22 Oct 2003 14:43:52 -0000	1.35.2.34
 @@ -285,10 +392,12 @@
      case 0x522910b9:	/* AcerLabs Aladdin IV/V */
  	/* the older Aladdin doesn't support ATAPI DMA on both master & slave */
 -	if (pci_get_revid(parent) < 0xc2 &&
 -	    ch->devices & ATA_ATAPI_MASTER && ch->devices & ATA_ATAPI_SLAVE) {
 +	if (chiprev < 0xc2 &&
 +	    atadev->channel->devices & ATA_ATAPI_MASTER &&
 +	    atadev->channel->devices & ATA_ATAPI_SLAVE) {
  	    ata_prtdev(atadev, "two atapi devices on this channel, no DMA\n");
  	    break;
  	}
 -	if (udmamode >= 5 && pci_get_revid(parent) >= 0xc4) {
 +	pci_write_config(parent, 0x58 + (channel << 2), 0x00310001, 4);
 +	if (udmamode >= 5 && chiprev >= 0xc4) {
  	    error = ata_command(atadev, ATA_C_SETFEATURES, 0,
  				ATA_UDMA5, ATA_C_F_SETXFER, ATA_WAIT_READY);
 %%%
 
 The pci_write_config() line is new.
 
 Bruce
State-Changed-From-To: open->closed 
State-Changed-By: sos 
State-Changed-When: Thu Jan 5 00:02:45 UTC 2006 
State-Changed-Why:  
Timeout, 6.0 shouldn't have this problem, and even 5.x might not. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=58458 
>Unformatted:
