Subject: bin/2549: /usr/sbin/config mistakely merges devices attached
To: None <gnats-bugs@NetBSD.ORG>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: netbsd-bugs
Date: 06/14/1996 21:44:04
	Note: There was a bad value `<high' for the field `>Priority:'.
	It was set to the default value of `medium'.

>Number:         2549
>Category:       bin
>Synopsis:       /usr/sbin/config mistakely merges devices attached
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 15 01:05:05 1996
>Originator:     Jonathan Stone
>Release:        1.2_ALPHA
System: NetBSD Reno.DSG.Stanford.EDU 1.2_ALPHA NetBSD 1.2_ALPHA (NEWCONF) #0: Fri Jun 14 09:53:40 PDT 1996 jonathan@Reno.DSG.Stanford.EDU:/usr/src/sys/arch/pmax/compile/NEWCONF pmax


NetBSD/pmax kernels misconfigure lance ethernet devices, due to
config(8)  erroneously merging device specifications for a lance
device on two separate busses, with distinct attachment structures,
into a single entry in  struct cfdata.  A full explanation follows.

NetBSD/pmax kernel config files specify that Lance ethernet devices
attach in one of three ways.

On the kn01 (pmax), which has no expamsion bus and no options save
a framebuffer, the lance driver attaches directly to the mainbus.
On machines with a DEC  IOCTL asic (ioasic, as used on Turbochannel Alphas),
the baseboard lance device is attached via the ioasic.
On the 5000/200, which lacks an ioctl asic, the baseboard lance device
emulates a TurboChannel option card, and attaches as a tc option card.
(tc option  cards attach via the turbochannel bus.)

Files.pmax lists these as
# LANCE ethernet driver.
#  XXX Should use new machine-independent one instead.
# device defined in sys/conf/files
attach le at ioasic with le_ioasic
attach le at tc with le_tc
attach le at mainbus with le_pmax
#file	arch/pmax/tc/if_le.c		(le_pmax|le_tc|le_ioasic) needs-flag

file	dev/tc/if_le_dec.c		(le_ioasic | le_tc | le_pmax)
file	dev/tc/if_le_ioasic.c		le_ioasic	needs-flag #for le_iomem
file	dev/tc/if_le_tc.c		le_tc
file	dev/tc/if_le_ibus.c		le_pmax		needs-flag #for kn01_intr


Configure a pmax kernel using the NEWCONF config file.
Examine the ioconf.c produced. Note how there's no entry for
an le device attached via mainbus using le_pmax_ca. config has
incorrectly merged that entry with the entry for ioasic-attached

Similarly, changing the order of the devices in the config file,
so that the le0 at mainbus appears first, results in a config file which

/*  0: le0 at mainbus0|ioasic0 */
    {&le_pmax_ca,	&le_cd,		 0, NORM,     loc,      0, pv+ 4, 0},

which *cannot* configure an ioasic-attached device.


Botching one or other of the ioasic or mainbus-attached devices
to be "le* at foobar" seems to cause config to stop merging
the le0 at ioasic|mainbus entries. However, that is not an acceptable
solution, as it causes the baseboard lance to configure as  le1,
which is most confusing.  (It also causes the NetBSD/kernel to crash
on a 3100.)
     to multiple busses with identical attributes but distinct attachments.