From owner-freebsd-i386@FreeBSD.ORG Mon Feb 25 21:53:38 2008 Return-Path: Delivered-To: freebsd-i386@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FA0016A406; Mon, 25 Feb 2008 21:53:38 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from falcon.cybervisiontech.com (falcon.cybervisiontech.com [217.20.163.9]) by mx1.freebsd.org (Postfix) with ESMTP id 95EB813C461; Mon, 25 Feb 2008 21:53:36 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from localhost (localhost [127.0.0.1]) by falcon.cybervisiontech.com (Postfix) with ESMTP id 0847F744002; Mon, 25 Feb 2008 23:53:35 +0200 (EET) X-Virus-Scanned: Debian amavisd-new at falcon.cybervisiontech.com Received: from falcon.cybervisiontech.com ([127.0.0.1]) by localhost (falcon.cybervisiontech.com [127.0.0.1]) (amavisd-new, port 10027) with ESMTP id JA5AczlB3-xx; Mon, 25 Feb 2008 23:53:34 +0200 (EET) Received: from [10.74.68.211] (unknown [193.138.145.51]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by falcon.cybervisiontech.com (Postfix) with ESMTP id 65B25744001; Mon, 25 Feb 2008 23:53:33 +0200 (EET) Message-ID: <47C338D5.2080906@icyb.net.ua> Date: Mon, 25 Feb 2008 23:53:25 +0200 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.9 (X11/20071208) MIME-Version: 1.0 To: Torfinn Ingolfsen References: <1203711782.00029509.1203698401@10.7.7.3> <1203711788.00029531.1203700205@10.7.7.3> In-Reply-To: <1203711788.00029531.1203700205@10.7.7.3> References: <20080222180012.aeda99e5.torfinn.ingolfsen@broadpark.no> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org, freebsd-i386@freebsd.org Subject: Re: sbc: isa plug-n-play X-BeenThere: freebsd-i386@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: I386-specific issues for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Feb 2008 21:53:38 -0000 on 22/02/2008 19:00 Torfinn Ingolfsen said the following: > On Fri, 22 Feb 2008 18:17:27 +0200 > Andriy Gapon wrote: > >> Everything works great. But recently I had an itch to go trough BIOS >> settings. I spotted one named "Plug-n-Play OS" and it was set to > > The BIOS setting "Plug and Play OS" usually means that the OS will do > its own little dance to set up any devices, so the bios just leaves > them alone. Yes. >> After that no joy, the soundcard stopped to work. It was detected as >> before, there is no difference in dmesg whatsoever, but it did not > > Are you sure that it was detected _exactly_ as before? With the same > irq(s), dma channels and so on? Yes, 100%, but see below. >> So I disabled the option again and everything is fine. >> Practical conclusion: don't do it. >> Question of curiosity: what is it that BIOS can do with this card that >> our driver can not ? > > Well, the bios (and acpi on systems that have it) set up devices by > assigning them irqs, io, memory and whatnot, if I undertstand this > correctly. > > My understanding is that FreeBSD uses this information to attach drivers > to the devices. If the devices are not set up correctly, FreeBSD either > might not find them or it can't use them correctly. Well, FreeBSD is a complete OS while BIOS is a small utility in NVRAM, so FreeBSD should be able and is able to do everything BIOS can and more (proprietary stuff excluded). Thank you for pointing me into the right direction - while the soundcard lines were precisely the same in both cases there were some interesting differences in other parts. Verbose dmesg with "non pnp os" bios setting: http://www.icyb.net.ua/~avg/verbose.dmesg.gz Verbose dmesg with "pnp os" bios setting: http://www.icyb.net.ua/~avg/verbose-pnp-os.dmesg.gz Diff between the former and the latter is pasted in-line at the end of this email. My understanding of that diff is the following. In the first case BIOS performs ISA PnP duties, finds the soundcard and assigns its resources (IRQ5 in particular). When the OS performs device probing and resource allocation it sees that IRQ5 is already taken. In the second case BIOS does nothing in this area. Then the OS first processes PCI devices and it assigns IRQ5 to one of the PCI devices (to avoid having to use irq sharing like it had in the previous case). Then the OS does ISA PnP probing, at this point IRQ5 is already taken. As I understand, at this moment there are actually no available IRQs that could be used by the soundcard (the card supports irqs 5,7,9,10 and they are all in use). In my opinion there should have been some kind of error here. Instead, the OS still assigns IRQ5 to the card and apparently that kind of interrupt "sharing"/assignment can not work. Some questions that I would like to ask in this regard: 1. Shouldn't FreeBSD have failed in the second case to find any resources for the soundcard? 2. Shouldn't resources for ISA PnP devices be allocated before resource allocation for PCI devices? 3. Maybe this is my own mistake? Should I mark resources used by ISA PnP devices as used by "legacy devices" in BIOS? I know this must help in my case, but my question is "must I be smart or must the OS be smart?". ============= The diff ==================================== > @@ -82,6 +82,7 @@ > acpi0: [ITHREAD] > acpi0: Power Button (fixed) > acpi0: wakeup code va 0xca041000 pa 0x1000 > +atpic: Programming IRQ9 as level/low ^^^ interesting > pci_open(1): mode 1 addr port (0x0cf8) is 0x80010014 > pci_open(1a): mode1res=0x80000000 (0x80000000) > pci_cfgcheck: device 0 [class=060000] [hdr=00] is there (id=71908086) > @@ -90,8 +91,8 @@ > Timecounter "ACPI-safe" frequency 3579545 Hz quality 850 > acpi_timer0: <24-bit timer at 3.579545MHz> port 0x4008-0x400b on acpi0 > pci_link0: Index IRQ Rtd Ref IRQs > - Initial Probe 0 7 N 0 3 4 5 6 7 10 11 12 14 15 > - Validation 0 7 N 0 3 4 5 6 7 10 11 12 14 15 > + Initial Probe 0 5 N 0 3 4 5 6 7 10 11 12 14 15 > + Validation 0 5 N 0 3 4 5 6 7 10 11 12 14 15 > After Disable 0 255 N 0 3 4 5 6 7 10 11 12 14 15 > pci_link1: Index IRQ Rtd Ref IRQs > Initial Probe 0 10 N 0 3 4 5 6 7 10 11 12 14 15 > @@ -106,8 +107,8 @@ > Validation 0 11 N 0 3 4 5 6 7 10 11 12 14 15 > After Disable 0 255 N 0 3 4 5 6 7 10 11 12 14 15 > pci_link3: Index IRQ Rtd Ref IRQs > - Initial Probe 0 9 N 0 3 4 5 6 7 10 11 12 14 15 > - Validation 0 9 N 0 3 4 5 6 7 10 11 12 14 15 > + Initial Probe 0 7 N 0 3 4 5 6 7 10 11 12 14 15 > + Validation 0 7 N 0 3 4 5 6 7 10 11 12 14 15 > After Disable 0 255 N 0 3 4 5 6 7 10 11 12 14 15 > cpu0: on acpi0 > cpu0: switching to generic Cx mode > @@ -115,7 +116,7 @@ > pcib0: port 0xcf8-0xcff,0x4000-0x4041,0x5000-0x500f on acpi0 > ACPI: Found matching pin for 0.9.INTA at func 0: 10 > ACPI: Found matching pin for 0.10.INTA at func 0: 11 > -ACPI: Found matching pin for 0.7.INTD at func 2: 9 > +ACPI: Found matching pin for 0.7.INTD at func 2: 7 > pci0: on pcib0 > pci0: domain=0, physical bus=0 > found-> vendor=0x8086, dev=0x7190, revid=0x03 > @@ -145,10 +146,10 @@ > class=0c-03-00, hdrtype=0x00, mfdev=0 > cmdreg=0x0005, statreg=0x0280, cachelnsz=0 (dwords) > lattimer=0x20 (960 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns) > - intpin=d, irq=9 > + intpin=d, irq=7 ^^^ interesting > map[20]: type I/O Port, range 32, base 0xd000, size 5, enabled > pcib0: matched entry for 0.7.INTD (src \\_SB_.PCI0.ISA_.LNKD:0) > -pcib0: slot 7 INTD routed to irq 9 via \\_SB_.PCI0.ISA_.LNKD > +pcib0: slot 7 INTD routed to irq 7 via \\_SB_.PCI0.ISA_.LNKD > found-> vendor=0x8086, dev=0x7113, revid=0x02 > domain=0, bus=0, slot=7, func=3 > class=06-80-00, hdrtype=0x00, mfdev=0 > @@ -201,7 +202,7 @@ > class=03-00-00, hdrtype=0x00, mfdev=1 > cmdreg=0x0007, statreg=0x02b0, cachelnsz=8 (dwords) > lattimer=0x20 (960 ns), mingnt=0x08 (2000 ns), maxlat=0x00 (0 ns) > - intpin=a, irq=7 > + intpin=a, irq=5 ^^^ interesting > powerspec 2 supports D0 D1 D2 D3 current D0 > map[10]: type Prefetchable Memory, range 32, base 0xd0000000, size 27, enabled > pcib1: requested memory range 0xd0000000-0xd7ffffff: good > @@ -210,8 +211,8 @@ > map[18]: type Memory, range 32, base 0xe1000000, size 16, enabled > pcib1: requested memory range 0xe1000000-0xe100ffff: good > pcib0: matched entry for 0.1.INTA (src \\_SB_.PCI0.ISA_.LNKA:0) > -pcib0: slot 1 INTA routed to irq 7 via \\_SB_.PCI0.ISA_.LNKA > -pcib1: slot 0 INTA is routed to irq 7 > +pcib0: slot 1 INTA routed to irq 5 via \\_SB_.PCI0.ISA_.LNKA > +pcib1: slot 0 INTA is routed to irq 5 > found-> vendor=0x1002, dev=0x5940, revid=0x01 > domain=0, bus=1, slot=0, func=1 > class=03-80-00, hdrtype=0x00, mfdev=0 > @@ -222,7 +223,7 @@ > pcib1: requested memory range 0xd8000000-0xdfffffff: good > map[14]: type Memory, range 32, base 0xe1010000, size 16, enabled > pcib1: requested memory range 0xe1010000-0xe101ffff: good > -vgapci0: port 0xc000-0xc0ff mem 0xd0000000-0xd7ffffff,0xe1000000-0xe100ffff irq 7 at device 0.0 on pci1 > +vgapci0: port 0xc000-0xc0ff mem 0xd0000000-0xd7ffffff,0xe1000000-0xe100ffff irq 5 at device 0.0 on pci1 > drm0: on vgapci0 > info: [drm] AGP at 0xe2000000 16MB > info: [drm] Initialized radeon 1.25.0 20060524 > @@ -249,7 +250,7 @@ > ata1: reset tp2 stat0=00 stat1=00 devices=0x4 > ata1: [MPSAFE] > ata1: [ITHREAD] > -uhci0: port 0xd000-0xd01f irq 9 at device 7.2 on pci0 > +uhci0: port 0xd000-0xd01f irq 7 at device 7.2 on pci0 > uhci0: Reserved 0x20 bytes for rid 0x20 type 4 at 0xd000 > uhci0: [GIANT-LOCKED] > uhci0: [ITHREAD] > @@ -322,7 +323,6 @@ > atkbdc: atkbdc0 already exists; skipping it > sio: sio0 already exists; skipping it > pnp_identify: Trying Read_Port at 203 > -pnp_identify: Trying Read_Port at 243 > CTL0044: start dependent (0) > CTL0044: adding irq mask 0x20 > CTL0044: adding dma mask 0x2 > @@ -391,8 +391,8 @@ > sc0: at flags 0x100 on isa0 > sc0: VGA <16 virtual consoles, flags=0x300> > sc0: fb0, kbd1, terminal emulator: sc (syscons terminal) > -sio1: irq maps: 0x21 0x29 0x21 0x21 > -sio1: irq maps: 0x21 0x29 0x21 0x21 > +sio1: irq maps: 0x1 0x9 0x1 0x1 > +sio1: irq maps: 0x1 0x9 0x1 0x1 > sio1 at port 0x2f8-0x2ff irq 3 on isa0 > sio1: type 16550A > sio1: [FILTER] -- Andriy Gapon