Subject: port-i386/18610: PNPBIOS beginning with a non-0 index may fail
To: None <gnats-bugs@gnats.netbsd.org>
From: Charlie Root <root@fsrv.plectere.com>
List: netbsd-bugs
Date: 10/10/2002 10:09:30
>Number:         18610
>Category:       port-i386
>Synopsis:       PNPBIOS beginning with a non-0 index may fail
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 10 10:10:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Paul Shupak
>Release:        NetBSD 1.6I, today
>Organization:
	
>Environment:
System: NetBSD fsrv 1.6I NetBSD 1.6I (FSRV) #234: Mon Oct 7 14:24:58 PDT 2002 root@fsrv:/usr/src/sys/arch/i386/compile/FSRV i386
Architecture: i386
Machine: i386
>Description:
	When the PNPBIOS start at an index other than zero ( allowed by the
spec & ASUS and others start at 1 ), the first index can not be properly
attached and an incorrect error messages is printed.
	In fact, whenever adjacent PNP entries do not have sequential numbers
( this occurs on Intel branded motherboards with some BIOS settings ), the
index after the gap cannot be attached correctly.
>How-To-Repeat:
	Try using the various PNPBIOS attachments on either an Intel
or Asus MB ( the ASUS will be easier  to see the problem ).
	
	"config" with PNPBIOS
	boot: netbsd
>Fix:
diff -c -r1.30 pnpbios.c
*** pnpbios.c	2002/10/02 05:47:17	1.30
--- pnpbios.c	2002/10/10 17:00:37
***************
*** 433,439 ****
  		int node = idx;
  		int dynidx;
  
! 		DPRINTF(("%s: getting info for index %d\n",
  		    sc->sc_dev.dv_xname, node));
  
  		res = pnpbios_getnode(PNP_CF_DEVCONF_STATIC, &idx, buf, size);
--- 433,439 ----
  		int node = idx;
  		int dynidx;
  
! 		DPRINTF(("%s: requesting info for index %d\n",
  		    sc->sc_dev.dv_xname, node));
  
  		res = pnpbios_getnode(PNP_CF_DEVCONF_STATIC, &idx, buf, size);
***************
*** 444,453 ****
  			continue;
  		}
  		dn = (struct pnpdevnode *)buf;
! 		if (dn->dn_handle != node)
! 			printf("%s: node index mismatch (static): "
! 			    "requested %d, got %d\n", sc->sc_dev.dv_xname,
! 			    node, dn->dn_handle);
  		if (!pnpbios_attachnode(sc, node, buf, dn->dn_size, 1)) {
  			DPRINTF(("%s index %d: no match from static config\n",
  			    sc->sc_dev.dv_xname, node));
--- 444,456 ----
  			continue;
  		}
  		dn = (struct pnpdevnode *)buf;
! 		if (dn->dn_handle != node) {
! 			if (node) /* it is OK for the vendor to start at >0 */
! 				printf("%s: node index mismatch (static): "
! 				    "requested %d, got %d\n",
! 				    sc->sc_dev.dv_xname, node, dn->dn_handle);
! 			node = dn->dn_handle;
! 		}
  		if (!pnpbios_attachnode(sc, node, buf, dn->dn_size, 1)) {
  			DPRINTF(("%s index %d: no match from static config\n",
  			    sc->sc_dev.dv_xname, node));
***************
*** 463,472 ****
  			continue;
  		}
  		dn = (struct pnpdevnode *)buf;
! 		if (dn->dn_handle != node)
! 			printf("%s: node index mismatch (dynamic): "
! 			    "requested %d, got %d\n", sc->sc_dev.dv_xname,
! 			    node, dn->dn_handle);
  		pnpbios_attachnode(sc, node, buf, dn->dn_size, 0);
  	}
  	if (i != num)
--- 466,478 ----
  			continue;
  		}
  		dn = (struct pnpdevnode *)buf;
! 		if (dn->dn_handle != node) {
! 			if (node) /* it is OK for the vendor to start at >0 */
! 				printf("%s: node index mismatch (dynamic): "
! 				    "requested %d, got %d\n",
! 				    sc->sc_dev.dv_xname, node, dn->dn_handle);
! 			node = dn->dn_handle;
! 		}
  		pnpbios_attachnode(sc, node, buf, dn->dn_size, 0);
  	}
  	if (i != num)
>Release-Note:
>Audit-Trail:
>Unformatted: