From owner-freebsd-hackers Wed Feb 12 15:03:06 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id PAA01664 for hackers-outgoing; Wed, 12 Feb 1997 15:03:06 -0800 (PST) Received: from terminator.informatik.ba-stuttgart.de (terminator.informatik.ba-stuttgart.de [141.31.1.21]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id PAA01659; Wed, 12 Feb 1997 15:02:48 -0800 (PST) Received: from helbig.informatik.ba-stuttgart.de (helbig.informatik.ba-stuttgart.de [141.31.166.22]) by terminator.informatik.ba-stuttgart.de (8.7.6/8.7.3) with ESMTP id XAA21625; Wed, 12 Feb 1997 23:02:04 +0100 Received: (from helbig@localhost) by helbig.informatik.ba-stuttgart.de (8.8.5/8.8.5) id AAA00343; Thu, 13 Feb 1997 00:02:35 +0100 (MET) From: Wolfgang Helbig Message-Id: <199702122302.AAA00343@helbig.informatik.ba-stuttgart.de> Subject: Re: CMD640b workaround - final(?) version In-Reply-To: <19970212213157.YA20116@x14.mi.uni-koeln.de> from Stefan Esser at "Feb 12, 97 09:31:57 pm" To: se@freebsd.org (Stefan Esser) Date: Thu, 13 Feb 1997 00:02:34 +0100 (MET) Cc: hackers@freebsd.org X-Mailer: ELM [version 2.4ME+ PL30 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Stefan Esser wrote > On Feb 11, helbig@MX.BA-Stuttgart.De (Wolfgang Helbig) wrote: > > If you use the > > options "CMD640" > > you also *have* to put > > controller pci0 > > into your configuration file! Maybe someone can put the right clauses > > in /sys/conf/files to automaticly resoving this (ugly) dependency! > > Ahemm ? > What I wanted to be achieved by changing /sys/conf/files is: If you put options "CMD640" in your kernel configuration file you will automatically get the pci-code included and started in the kernel, even if you don't put the controller pci0 line in the configuration file. Since I do not grasp the workings of /sys/conf/files and /sys/i386/conf/files.i386, I don't know whether this is possible. Now suppose a newbie has installed successfully FreeBSD on a machine with the CMD640b-controller, (because the generic kernel does have options "CMD640" and controller pci0). He does not even know, that he has something special, because he used the same machine with Windos and LINUX before and didn't have any trouble. (ok, the newbie is me :-) ) Now he want's to build a customized kernel. He will find out that he needs the CMD640b option (as I would have found out) and that he does not need the pci-controller code, because it does not do any good. (That is the way I proceeded. I did not have the pci-code in my kernel.) So now if you leave the definition of cmd640_detected in pci.c our newbie will get a link error. If you put this definition in wd.c, our newbie will not get a link error but the kernel will freeze after the first attempt to use both ide-channels simultaneously. I believe the second perspective is worse, because it is harder to recover and early detected errors are less harmful in general. > The CMD640 option obviously makes no sense on a system > without a PCI bus. But I agree, that it violates the But a kernel w/o pci-support *does* make sense on a system with PCI bus, because the pci-code is simply overhead if no pci-drivers get installed. > principle of least surprise, if this option causes a > kernel build to fail for a non-PCI system (without the > controller pci0 line). > > > There are 2 possible workarounds: > > 1) Include pci.h into the wd driver, and #undef CMD640, > if NCPI == 0. > > 2) Move the definition of "cmd640_detected" into wd.c, > and make the PCI probe code use it as an *external* > variable only if CMD640 is defined. > > > BTW: I do heavily dislike the way you introduced the PCI > ID of the CMD640 into pci.c, and will not accept it! > > There is NO device specific code in pci.c for a reason! BTW: My solution is simpler. For a reason! I do heavily dislike complicated code if there is a simpler way! Do whatever you want with it, I will accept it! Wolfgang Helbig.