Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Oct 1995 09:04:59 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        hackers@freebsd.org, uhclem%nemesis@fw.ast.com
Subject:   Re: I/O port 0 == autoconfig?
Message-ID:  <199510122304.JAA09320@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>Subject: I/O port 0 == autoconfig?

Nope.

>In the more recent releases, a "visual" mode has been added
>to the kernel -c feature.   In case you haven't played around
>with it, one of the things it does is only offer the user
>a limited number of choices for what settings can be altered on
>a given device.  "Visual" (for lack of a better name) 
>decides values can't be changed by seeing if the kernel config
>value for a given parameter was -1.  If it's something else, it
>lets you change it.  If it was -1, you can't.

>At least one place where this strategy has conflicted is the matcd driver.
>It used -1 for the I/O port to signify that it would probe a list
>of "known" locations for that hardware, rather than requiring the
>user to know.  (On some SoundBlaster cards, it is difficult

-1 means both "autoconfig" and "none", unfortunately.  Treating -1 only
as "none" breaks things in many other places:

1) in lpt, an irq of -1 means "autoconfig".  The visual config doesn't
   allow changing either to or from irq -1.  For irqs, it's the vector
   that determines whether an irq can be used.  If the vector is 0,
   then changing the irq to anything other than -1 will probably cause
   a panic.  If the vector isn't 0, then obviously the driver is
   prepared to handle irqs.

2) in lpt, a port of 0xffffffff means "autoconfig".  The visual config
   doesn't allow changing either to or from this (the field isn't long
   enough to accept all the `f's and `-' is not accepted.

3) in sio, an irq of -1 means polled mode.  As in (1), there is no way
   to switch to or from this.

>for the user to determine what I/O addresses the card is using because
>Creative Labs didn't write the information down anywhere and the
>DOS drivers only list the base address for the audio sections of the card.)

Builtin lists of "known" locations in drivers are evil.  They defeat
conflict checking and may stomp on other devices.  The information about
them is hard to find at visual config time.  Please remove the one in
matcd.  I have to remove the one in sio.  Although the location of sio3
is more standard than the location of matcd devices, writing to a
standard address for sio3 (as is required to configure sio1 if the irqs
are shared) is reported to stomp on some S3 cards.  Writing to port
0x230 for matcd would stomp on my BT445S.

>On the other hand, I proposed making "-1" an exception for I/O ports,
>since all drivers I know require at least one I/O port, so the field
>can never be set to "no ports needed".   Mike indicates that dealing
>with a negative number in "visual" would be nasty and that this wasn't
>really an option.   I haven't had time to look at his code, so I don't
>know one way or the other.

Several memory-mapped devices don't need an i/o port.

>Since we seem to be limited to the first choice (unless you have a
>better idea that doesn't eliminate the autoconfiguration capability),
>and so the question is, does anybody see any near-term problems
>with a change like this:
>	Change "visual" to treat "0" as an autoconfiguring I/O port
>	parameter (can't be done for DMA or IRQs since 0 is legal for both)

>	Change the matcd driver and any other drivers doing similar
>	things to use "0" as the key for autoconfiguring the I/O port
>	it uses.

Yes, it would require changing config to generate port 0 for "port ?"
and all drivers to know about the kludge, and this only works for ports,
not for irqs.  It would be better to change config and visual config to
support new out of bounds values (-2, perhaps) for "none".  Leaving -1
as meaning "autoconfig" probably allows avoiding changes in drivers
(drivers that don't have ports presumably don't care what the port is
specified to be, and drivers that support autoconfig of ports presumably
check for `== -1'.

Bruce



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