Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Feb 2008 23:53:25 +0200
From:      Andriy Gapon <avg@icyb.net.ua>
To:        Torfinn Ingolfsen <torfinn.ingolfsen@broadpark.no>
Cc:        freebsd-hackers@freebsd.org, freebsd-i386@freebsd.org
Subject:   Re: sbc: isa plug-n-play
Message-ID:  <47C338D5.2080906@icyb.net.ua>
In-Reply-To: <1203711788.00029531.1203700205@10.7.7.3>
References:  <20080222180012.aeda99e5.torfinn.ingolfsen@broadpark.no>

next in thread | previous in thread | raw e-mail | index | archive | help
on 22/02/2008 19:00 Torfinn Ingolfsen said the following:
> On Fri, 22 Feb 2008 18:17:27 +0200
> Andriy Gapon <avg@icyb.net.ua> 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: <ACPI CPU> on acpi0
>  cpu0: switching to generic Cx mode
> @@ -115,7 +116,7 @@
>  pcib0: <ACPI Host-PCI bridge> 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: <ACPI PCI bus> 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: <VGA-compatible display> port 0xc000-0xc0ff mem
0xd0000000-0xd7ffffff,0xe1000000-0xe100ffff irq 7 at device 0.0 on pci1
> +vgapci0: <VGA-compatible display> port 0xc000-0xc0ff mem
0xd0000000-0xd7ffffff,0xe1000000-0xe100ffff irq 5 at device 0.0 on pci1
>  drm0: <ATI Radeon RV280 9250> 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<ATAPI_MASTER>
>  ata1: [MPSAFE]
>  ata1: [ITHREAD]
> -uhci0: <Intel 82371AB/EB (PIIX4) USB controller> port 0xd000-0xd01f
irq 9 at device 7.2 on pci0
> +uhci0: <Intel 82371AB/EB (PIIX4) USB controller> 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: <System console> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47C338D5.2080906>