Date: Fri, 30 Aug 2002 22:32:14 +0100 (IST) From: Adrian Colley <aecolley@spamcop.net> To: FreeBSD-gnats-submit@FreeBSD.org Subject: kern/42228: BIOS drive 0x80 (on atapci0) is misnumbered ata2 Message-ID: <20020830213214.BC883280@cornerstone.colley.ie>
next in thread | raw e-mail | index | archive | help
>Number: 42228 >Category: kern >Synopsis: BIOS drive 0x80 (on atapci0) is misnumbered ata2 >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Aug 30 14:40:03 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Adrian Colley <aecolley@spamcop.net> >Release: FreeBSD 4.6.2-RELEASE i386 >Organization: YKYBHTLW, Inc. >Environment: System: FreeBSD cornerstone.colley.ie 4.6.2-RELEASE FreeBSD 4.6.2-RELEASE #0: Fri Aug 23 14:09:07 IST 2002 root@:/usr/obj/usr/src/sys/CORNERSTONE i386 This machine is running a slightly hacked kernel (see patch below). Under 4.5-RELEASE the GENERIC kernel booted OK, but under 4.6.2-RELEASE the GENERIC kernel failed to find the root disk as described below. This PR refers to the unfortunate behaviour of the standard GENERIC kernel. This machine is an old Gateway 2000 box with a Neptune chipset and a PC-Tech RZ-1000 PCI/IDE controller (danger Will Robinson). The RZ-1000 has a single IDE channel (selected as the primary in the BIOS). There is a secondary (ISA) IDE controller, but it's unused. dmesg.boot (with patched kernel): Copyright (c) 1992-2002 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.6.2-RELEASE #0: Fri Aug 23 14:09:07 IST 2002 root@:/usr/obj/usr/src/sys/CORNERSTONE Timecounter "i8254" frequency 1193182 Hz CPU: Pentium/P54C (90.21-MHz 586-class CPU) Origin = "GenuineIntel" Id = 0x524 Stepping = 4 Features=0x1bf<FPU,VME,DE,PSE,TSC,MSR,MCE,CX8> real memory = 33554432 (32768K bytes) avail memory = 29437952 (28748K bytes) Preloaded elf kernel "kernel" at 0xc032c000. Intel Pentium detected, installing workaround for F00F bug Using $PIR table, 4 entries at 0xc00f99e0 apm0: <APM BIOS> on motherboard apm: found APM BIOS v1.1, connected at v1.1 npx0: <math processor> on motherboard npx0: INT 16 interface pcib0: <Host to PCI bridge> on motherboard pci.c cornerstone: progif 0 -> 0x81 pci0: <PCI bus> on pcib0 atapci0: <RZ 100? ATA controller !WARNING! buggy chip data loss possible> port 0x3f4-0x3f7,0x1f0-0x1f7 at device 1.0 on pci0 atapci0: Busmastering DMA not supported atapci0: Busmastering DMA disabled atapci0: ata_pci_add_child: masterdev (unit=0x0) atapci0: ata_pci_add_child: masterdev (unit=0x1) ata0: at 0x1f0 irq 14 on atapci0 ata1: at 0x170 irq 15 on atapci0 isab0: <Intel 82378IB PCI to ISA bridge> at device 2.0 on pci0 isa0: <ISA bus> on isab0 ed0: <NE2000 PCI Ethernet (RealTek 8029)> port 0xfce0-0xfcff irq 11 at device 6.0 on pci0 ed0: address 00:c0:df:f5:d9:07, type NE2000 (16 bit) pci0: <ATI Mach64-GX graphics accelerator> at 14.0 orm0: <Option ROM> at iomem 0xc0000-0xc7fff on isa0 atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0 atkbd0: <AT Keyboard> flags 0x1 irq 1 on atkbdc0 kbd0 at atkbd0 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> at flags 0x100 on isa0 sc0: VGA <16 virtual consoles, flags=0x300> 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 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 0x278-0x27f irq 7 on isa0 ppc0: SMC FDC37C665GT chipset (PS2/NIBBLE) in COMPATIBLE mode ppbus0: IEEE1284 device found /NIBBLE Probing for PnP devices on ppbus0: ppbus0: <Canon BJC-1000/1.21> PRINTER BJL,BJRaster,BSCC,TXT01 lpt0: <Printer> on ppbus0 lpt0: Interrupt-driven port ata4: <Generic ESDI/IDE/ATA controller> at port 0x168-0x16f,0x36e-0x36f irq 10 on isa0 IP packet filtering initialized, divert disabled, rule-based forwarding disabled, default to deny, logging disabled IPv6 packet filtering initialized, logging disabled IPsec: Initialized Security Association Processing. ad0: 9773MB <FUJITSU MPG3102AT E> [19857/16/63] at ata0-master BIOSPIO acd0: DVD-ROM <IDE DVD-ROM 16X> at ata0-slave BIOSPIO Mounting root from ufs:/dev/ad0s2a >Description: The PCI class/subclass/progif of the RZ-1000 is "01-01-00" (meaning IDE storage). ata_pci_add_child (/sys/dev/ata/ata-pci.c:342) reserves unit numbers 0 and 1 (i.e. ata0 & ata1) for "masterdev" devices. Although I do not completely understand the significance of "masterdev", it appears to depend on certain bits in the progif byte of the device's PCI configuration. As the RZ-1000 reports 00 for progif, it fails the ATA_MASTERDEV test and is given ata2. Some attempt is made to allocate an interrupt for ata2, but it fails (though this doesn't seem immediately relevant). The ata0 device is never recognised. Since it contains the system's only hard-disk drive, no "ad" devices are created. Mounting the root fails, and there is no way to express its location without an "ad0". >How-To-Repeat: Find a machine with an RZ-1000 at your local landfill. Install PhoenixBIOS on it. Configure PCI-IDE as primary IDE. Attempt to install FreeBSD 4.6.2-RELEASE on it. >Fix: My workaround was to fake a progif of 0x81 for the RZ-1000 in /sys/pci/pci.c: --- pci.c.orig Fri Aug 30 21:33:21 2002 +++ pci.c Fri Aug 30 21:33:00 2002 @@ -217,6 +217,19 @@ /* PCI to PCI bridges use header type 1 */ if (cfg->baseclass == PCIC_BRIDGE && cfg->subclass == PCIS_BRIDGE_PCI) cfg->hdrtype = 1; +#define AEC_CORNERSTONE_HACK 1 +#ifdef AEC_CORNERSTONE_HACK + /* The RZ1000 identifies as 01-01-00 (storage-ide-normal) even though + * selected as primary IDE in the BIOS. Change its progif so that + * it becomes 01-01-81 (storage-ide-masterdev+modeprim). + */ + if (cfg->baseclass == PCIC_STORAGE && cfg->subclass == PCIS_STORAGE_IDE + && cfg->progif == 0 && cfg->vendor == 0x1042 && cfg->device == 0x1000) + { + cfg->progif = 0x81; + printf("pci.c cornerstone: progif 0 -> 0x%x\n", cfg->progif); + } +#endif /* AEC_CORNERSTONE_HACK */ } /* read config data specific to header type 1 device (PCI to PCI bridge) */ This is obviously a hack unacceptable for general use. I have tried using pciconf -w to update the progif register, but it had no effect (I am exposing my lack of knowledge of PCI architecture here). My request is this: introduce some way (userconfig?) to allow the installing user to force such a drive to be recognised as ata0 in spite of its progif. I have no more specific suggestion because I don't know what's possible with the limitations of PCI. Certainly it seems that the stock GENERIC binary is incapable of adapting to this situation without a recompile. Perhaps my machine is just a freak, and should be reporting a progif of 0x81 in the first place. A brief digression on the RZ-1000: although it represents the pinnacle of the Laurel and Hardy style of engineering, it was distributed in many popular doorst^Wdesktop PCs some years ago. Old PCs are my favourite showcase for FreeBSD, because they are demonstrably useful and fast despite user expectations (just don't install KDE or Gnome). The flaws of the RZ-1000 (search for EIDEFLAW.TXT or eidete19.zip), although comic and tragic for the same reasons, can be worked around at a mere 50% loss in advertised performance. My point is that these stupid chips should not be banished to the limbo of "not officially supported" just because they lack fitness for any particular purpose (see /COPYRIGHT). (Yes, I _could_ disable the PCI-IDE controller and redesignate the ISA IDE controller as primary, and move the ribbon cable, thereby sidestepping the whole problem. What's your point?) >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020830213214.BC883280>