From owner-freebsd-current Sat Jul 7 14:53:54 2001 Delivered-To: freebsd-current@freebsd.org Received: from peter3.wemm.org (c1315225-a.plstn1.sfba.home.com [65.0.135.147]) by hub.freebsd.org (Postfix) with ESMTP id 80E2B37B401; Sat, 7 Jul 2001 14:53:44 -0700 (PDT) (envelope-from peter@wemm.org) Received: from overcee.netplex.com.au (overcee.wemm.org [10.0.0.3]) by peter3.wemm.org (8.11.0/8.11.0) with ESMTP id f67LriM75460; Sat, 7 Jul 2001 14:53:44 -0700 (PDT) (envelope-from peter@wemm.org) Received: from wemm.org (localhost [127.0.0.1]) by overcee.netplex.com.au (Postfix) with ESMTP id 4B1F2380F; Sat, 7 Jul 2001 14:53:44 -0700 (PDT) (envelope-from peter@wemm.org) X-Mailer: exmh version 2.3.1 01/18/2001 with nmh-1.0.4 To: Warner Losh Cc: Mike Smith , Makoto MATSUSHITA , sos@freebsd.dk, current@FreeBSD.ORG Subject: Re: Problems with ata probing twice. In-Reply-To: <200107072102.f67L2QJ72605@harmony.village.org> Date: Sat, 07 Jul 2001 14:53:44 -0700 From: Peter Wemm Message-Id: <20010707215344.4B1F2380F@overcee.netplex.com.au> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Warner Losh wrote: > In message <200107072004.f67K4S701211@mass.dis.org> Mike Smith writes: > : > > : > sos> Well, sortof, the ata driver doesn't allow for sharing irq14&15 > : > sos> since lots of boards doesn't work that way. However if you need > : > sos> it you can try to add the shared flag in the driver and see if > : > sos> it works on yours. Hmm, maybe I should make this tunable... > : > > : > It this patch OK? I've tested a kernel with this patch and it works. > : > > : > This patch simply adds a new kernel MIB (hw.ata.shareable in this > : > patch, but I have no idea about its name), and if this MIB value is > : > non-zero, ata driver doesn't drop RF_SHAREABLE bit for BUS_ALLOC_RESOURCE (). > : > : No. This is utterly bogus. > : > : There is absolutely no reason for the ata driver not to simply set > : RF_SHAREABLE and be done with it. It's up to the driver's parent (isa, > : pci, etc) to decide whether the interrupt is in fact shareable or not. > : > : The ata driver itself can share interrupts just fine, and it should > : reflect this in its interrupt allocation. > > Actually, there is a reason. Ata is special like pcic is special. > Both of them can have multiple interrupt routing methods. When ata is > connected directly to the south bridge, it can route ISA interrupts, > even though it is a pci device. In this case, it is unsafe to share > interrupts between the ata device and anything else. Even though it > looks like a pci device, the interrupt routing is ISA. This series of issues burns the SMP folk regularly. A quick backgrounder for the gallery: - pre EISA/PCI systems: only had ISA. The interrupt was high-edge triggered. ie: the act of the PIC signal being pushed high caused the event. - EISA era: EISA supported level triggering, usually active low I think. A device was added in the interrupt pin path and it had an 'ELCR' (Edge/ Level Control Register). This lives at IO port 0x4d0/4d1. A single bit per interrupt determines if the IRQ is reshaped from low-level trigger to high-edge. The PIC is still programmed in high-edge mode for DOS compatability etc. - PCI era: interrupt routing was added, sometimes within the south bridge, other times as a seperate ASIC. The ELCR is still present at the same IO ports, but the ASIC that does the routing (if it exists) is at different locations. Later chipsets mostly did the routing within the south bridge, and with a limited number of pins on the chip. Quite often a bunch of 'GPIO' (General Purpose IO) pins could be assigned for various things including routable interrupt sources. - SMP era: a seperate PIC (APIC) was added. There is now a seperate interrupt pathway from the PCI slots to the APIC and from the ISA slots to the APIC. There is a "magic" device that does the bridging between the two systems. This gets complicated because we have to emulate the EISA level sensitive interrupts by reading the ELCR and programming the corresponding ISA sources in level mode vs the usual edge trigger mode. However, things have got really interesting lately. Some motherboards are setting up shareable level triggered interrupts for the onboard ISA devices. eg: fdc, com1, com2, lpt, etc. These show up in the MPTABLE as level triggered mode, and are programmed in the ELCR as level triggered. ie: many of the 'traditional ISA' interrupt nubmers are actually shareable. If my memory serves me correctly, some Intel and Serverworks south bridges can be programmed to use one GPIO pin as a shareable IRQ 15 input. The ATA controller can even be programmed to use a single IRQ (IRQ 14 only) for both channels because it is level triggered internally within the south bridge. The upshot of this is that drivers should be setting RF_SHAREABLE if they themselves can handle the possibility that the motherboard is wired up for sharing their IRQ. It is up to the bus controller to sort out what is really electrically shareable and what is not... the drivers themselves do not have this information (and should not be looking for it). I expect the bus drivers need more work in this area. The mere fact that the ata driver has calls into the Alpha IDE interrupt routing code alone indicates that the bus bridge drivers need more work. Cheers, -Peter -- Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au "All of this is for nothing if we don't go to the stars" - JMS/B5 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message