Subject: Multiple values for locators
To: None <tech-kern@NetBSD.ORG>
From: Charles M. Hannum <>
List: tech-kern
Date: 03/25/1997 17:26:36
I have a severe need to express multiple values for a locator for
indirect devices.  e.g.  I need to be able to do:

sb0 at isa? port 0x220 irq 1 drq 1,5
gus0 at isa? port 0x300 irq 1 drq 5,7

Right now, where this is done at all, it's typically done via some
hack involving the `flags' field.

The way I propose to do this is non-invasive; it will not affect any
drivers for busses that do not support multiply-valued locators.  The
idea is as follows:

* Extend the attribute definition syntax to allow multiple
initializers.  e.g.:

device  isa {[port = -1,-1,-1,-1], [size = 0,0,0,0],
             [iomem = -1,-1,-1,-1], [iosiz = 0,0,0,0],
             [irq = -1,-1], [drq = -1,-1]}

* Extend the device definition syntax to allow multiple values, as
above.  e.g.:

sb0 at isa? port 0x220 irq 1 drq 1,5
gus0 at isa? port 0x300 irq 1 drq 5,7

* Use the number of initializers to size the space used in cf_loc[]
for the values.  Always allocate space for the maximum number of
values.  (Thus the values are still at fixed locations in the array,
as they are now.)

[An alternative to counting the initializers would have been to
introduce a syntax for explicitly specifying the maximum number in the
attribute declaration.  But there'd still need to be a way to specify
the multiple initializers anyway.]

* Have the macros in locators.h point to the beginning of the list for
a given value (e.g. you'd use `cf_loc[ISACF_PORT + 0]',
`cf_loc[ISACF_PORT + 1]', etc., to reference the values), and have the
foocf_locnames[] array contain `locator[N]' (e.g. `port[0]' and
`port[1]').  For attributes with only one initializer, have
foocf_locnames[] just contain the name, as before.

* Count the number of values specified for each locator, and put these
counts at the end of cf_loc[], introducing another set of constants
(FOOCF_NLOCATOR) to access them.

So, does anyone have a reasonable objection to the above?