NetBSD Problem Report #34219

From andreas@woffi.wrede.pvt  Wed Aug 16 23:01:14 2006
Return-Path: <andreas@woffi.wrede.pvt>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 0EC8F63BA82
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 16 Aug 2006 23:01:14 +0000 (UTC)
Message-Id: <20060816205708.48A0552BF@woffi.wrede.pvt>
Date: Wed, 16 Aug 2006 16:57:08 -0400 (EDT)
From: andreas@planix.com
Reply-To: andreas@planix.com
To: gnats-bugs@NetBSD.org
Subject: ubtbcmfw.c does not compile
X-Send-Pr-Version: 3.95

>Number:         34219
>Category:       kern
>Synopsis:       ubtbcmfw.c does not compile
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    plunky
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 16 23:05:00 +0000 2006
>Closed-Date:    Sat Aug 19 16:39:48 +0000 2006
>Last-Modified:  Fri Aug 25 12:35:00 +0000 2006
>Originator:     Andreas Wrede <andreas@planix.com>
>Release:        NetBSD 4.0_BETA
>Organization:
Planix, Inc.
>Environment:


System: NetBSD waci 4.0_BETA NetBSD 4.0_BETA (PLANIX.MPACPI) #0: Wed Aug 16 09:46:35 EDT 2006  root@woffi.wrede.pvt:/m5/netbsd-4.0/obj.i386/sys/arch/i386/compile/PLANIX.MPACPI i386
Architecture: i386
Machine: i386
>Description:

/m5/netbsd-4.0/src/sys/dev/usb/ubtbcmfw.c: In function 'ubtbcmfw_attach':
/m5/netbsd-4.0/src/sys/dev/usb/ubtbcmfw.c:156: warning: passing argument 3 of 'ubtbcmfw_write' discards qualifiers from pointer target type
/m5/netbsd-4.0/src/sys/dev/usb/ubtbcmfw.c: In function 'ubtbcmfw_load_file':
/m5/netbsd-4.0/src/sys/dev/usb/ubtbcmfw.c:231: error: 'time' undeclared (first use in this function)
/m5/netbsd-4.0/src/sys/dev/usb/ubtbcmfw.c:231: error: (Each undeclared identifier is reported only once
/m5/netbsd-4.0/src/sys/dev/usb/ubtbcmfw.c:231: error: for each function it appears in.)
/m5/netbsd-4.0/src/sys/dev/usb/ubtbcmfw.c:261: error: 'p' undeclared (first use in this function)


>How-To-Repeat:
	add 'ubtbcmfw* at uhub? port ? configuration ? interface ?'
	to your kernel config, compile
>Fix:

>Release-Note:

>Audit-Trail:
From: Dave Tyson <Dave.Tyson@liverpool.ac.uk>
To: gnats-bugs@netbsd.org
Cc: netbsd-bugs@netbsd.org, Andreas Wrede <andreas@planix.com>
Subject: Re: kern/34219: ubtbcmfw.c does not compile
Date: Thu, 17 Aug 2006 11:30:12 +0100

 On Thursday 17 August 2006 00:05, andreas@planix.com wrote:
 > >Number:         34219
 > >Category:       kern
 > >Synopsis:       ubtbcmfw.c does not compile
 > >Confidential:   no
 > >Severity:       serious
 > >Priority:       medium
 > >Responsible:    kern-bug-people
 > >State:          open
 > >Class:          sw-bug
 > >Submitter-Id:   net
 > >Arrival-Date:   Wed Aug 16 23:05:00 +0000 2006
 > >Originator:     Andreas Wrede <andreas@planix.com>
 > >Release:        NetBSD 4.0_BETA
 > >Organization:
 >
 > Planix, Inc.
 >
 > >Environment:
 >
 > System: NetBSD waci 4.0_BETA NetBSD 4.0_BETA (PLANIX.MPACPI) #0: Wed Aug 16
 > 09:46:35 EDT 2006 
 > root@woffi.wrede.pvt:/m5/netbsd-4.0/obj.i386/sys/arch/i386/compile/PLANIX.M
 >PACPI i386 Architecture: i386
 > Machine: i386
 >
 > >Description:
 >
 > /m5/netbsd-4.0/src/sys/dev/usb/ubtbcmfw.c: In function 'ubtbcmfw_attach':
 > /m5/netbsd-4.0/src/sys/dev/usb/ubtbcmfw.c:156: warning: passing argument 3
 > of 'ubtbcmfw_write' discards qualifiers from pointer target type
 > /m5/netbsd-4.0/src/sys/dev/usb/ubtbcmfw.c: In function
 > 'ubtbcmfw_load_file': /m5/netbsd-4.0/src/sys/dev/usb/ubtbcmfw.c:231: error:
 > 'time' undeclared (first use in this function)
 > /m5/netbsd-4.0/src/sys/dev/usb/ubtbcmfw.c:231: error: (Each undeclared
 > identifier is reported only once
 > /m5/netbsd-4.0/src/sys/dev/usb/ubtbcmfw.c:231: error: for each function it
 > appears in.) /m5/netbsd-4.0/src/sys/dev/usb/ubtbcmfw.c:261: error: 'p'
 > undeclared (first use in this function)
 >
 > >How-To-Repeat:
 >
 > 	add 'ubtbcmfw* at uhub? port ? configuration ? interface ?'
 > 	to your kernel config, compile
 >
 > >Fix:
 The following fix works with GCC4 on NetBSD-4_BETA and allows the microcode to 
 download into the Broadcom bluetooth device. Only plug the device in after the
 kernel has booted :-)

 The horrible kludge with  char term[2]="#" ; works around a warning GCC issues
 about  "discards qualifiers from pointer target type"

 Iain Hibbert is working on a replacement userland program to do away with 
 ubtbcmfw.c

 Dave

 --- ubtbcmfw.c.orig     2006-08-17 10:01:44.000000000 +0100
 +++ ubtbcmfw.c  2006-08-17 11:12:15.000000000 +0100
 @@ -113,6 +113,7 @@
         usbd_pipe_handle intr_in_pipe;
         usbd_pipe_handle bulk_out_pipe;
         uint n;
 +       char term[2]="#" ;

         devinfop = usbd_devinfo_alloc(dev, 0);
         USB_ATTACH_SETUP;
 @@ -153,7 +154,7 @@
                 USB_ATTACH_ERROR_RETURN;
         }
         usbd_delay_ms(dev, 1);
 -       err = ubtbcmfw_write(dev, bulk_out_pipe, "#", 1);
 +       err = ubtbcmfw_write(dev, bulk_out_pipe, term, 1);
         if (err) {
                 printf("%s: write # failed\n", USBDEVNAME(sc->sc_dev));
                 USB_ATTACH_ERROR_RETURN;
 @@ -220,7 +221,7 @@
         size_t resid, offs, size;
         int error;
         char buf[1024];
 -       struct timeval delta;
 +       struct timeval delta, time;

         NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, filename, curlwp);
         /* Loop until we are well passed boot */
 @@ -228,6 +229,7 @@
                 error = vn_open(&nd, FREAD, 0);
                 if (!error)
                         break;
 +               microtime(&time) ;
                 timersub(&boottime, &time, &delta);
                 if (delta.tv_sec > 60)
                         break;
 @@ -258,7 +260,7 @@
         }

  out:
 -       vn_close(vp, FREAD, l->l_cred, p);
 +       vn_close(vp, FREAD, l->l_cred, l);
         return error;
  }

 > >Unformatted:


 -- 
 =====================================================================
 Computing Services Dept         Phone/Fax: 0151-794-3731/3759
 The University of Liverpool     Email: dtyson@liv.ac.uk
 Chadwick Tower, Peach Street    WWW:   http://www.liv.ac.uk/~dtyson
 Liverpool L69 7ZF               Open Source O/S: www.netbsd.org
 =====================================================================

From: Andreas Wrede <andreas@planix.com>
To: Dave Tyson <Dave.Tyson@liverpool.ac.uk>
Cc: gnats-bugs@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: kern/34219: ubtbcmfw.c does not compile
Date: Thu, 17 Aug 2006 09:40:17 -0400

 This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
 --Apple-Mail-6--726324781
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed


 On Aug 17, 2006, at 6:30 , Dave Tyson wrote:
 > The following fix works with GCC4 on NetBSD-4_BETA and allows the  
 > microcode to
 > download into the Broadcom bluetooth device.

 That works! Thanks for the quick response.

 > Only plug the device in after the
 > kernel has booted :-)

 I see what you mean... panic  but it's workable for testing.

 > Iain Hibbert is working on a replacement userland program to do  
 > away with
 > ubtbcmfw.c

 Hmm, userland?  How about a firmload(9) based kernel solution?

 > Dave

 -- 
      aew


 --Apple-Mail-6--726324781
 content-type: application/pgp-signature; x-mac-type=70674453;
 	name=PGP.sig
 content-description: This is a digitally signed message part
 content-disposition: inline; filename=PGP.sig
 content-transfer-encoding: 7bit

 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.1 (Darwin)

 iD8DBQFE5HHEEh/h9J/TQyERAt30AKDf/erTPsxtVE00Zv3UyaYLuOpiewCgkYjs
 LReQi6NMOzhJ6T06QWFLCPA=
 =f5v/
 -----END PGP SIGNATURE-----

 --Apple-Mail-6--726324781--

Responsible-Changed-From-To: kern-bug-people->plunky
Responsible-Changed-By: plunky@netbsd.org
Responsible-Changed-When: Sat, 19 Aug 2006 15:24:01 +0000
Responsible-Changed-Why:
I am working on removing this driver and replacing it with another method
to load the firmware via a ugen(4) device.


From: Iain Hibbert <plunky@rya-online.net>
To: gnats-bugs@netbsd.org, Andreas Wrede <andreas@planix.com>
Cc: 
Subject: Re: kern/34219: ubtbcmfw.c
Date: Sat, 19 Aug 2006 16:24:07 +0100 (BST)

 The reason we can't use firmload(9) really is to do with timing - there is
 no realy way for the kernel to know when its safe to do so, and because
 the device detaches after you load the firmware (and comes back as
 something else) it would get complicated if we waited until the device was
 being activated before we loaded it.

 I have a bcmfw package (pending in pkgsrc-wip at the moment) that will
 push the firmware into a ugen device, so in a bit I will remove the
 ubtbcmfw(4) device and add something to ubt_match to make it ignore the
 vendor/product ID pair of the firmware-less version.

 iain

State-Changed-From-To: open->closed
State-Changed-By: plunky@netbsd.org
State-Changed-When: Sat, 19 Aug 2006 16:39:48 +0000
State-Changed-Why:
I have removed the ubtbcmfw(4) driver.


From: Iain Hibbert <plunky@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/34219 CVS commit: src
Date: Sat, 19 Aug 2006 16:35:03 +0000 (UTC)

 Module Name:	src
 Committed By:	plunky
 Date:		Sat Aug 19 16:35:03 UTC 2006

 Modified Files:
 	src/distrib/sets/lists/man: mi
 	src/share/man/man4: Makefile ubt.4
 	src/sys/dev: DEVNAMES
 	src/sys/dev/usb: FILES files.usb ubt.c
 Removed Files:
 	src/share/man/man4: ubtbcmfw.4
 	src/sys/dev/usb: ubtbcmfw.c

 Log Message:
 The ubtbcmfw(4) driver fails to compile, as noted by PR kern/34219.

 While it can be made to compile, the paradigm is not quite right because
 it attempts to contact the filesystem during autoconfig which sometimes
 causes a panic. Even if that was fixed, there is another potential problem
 in that the driver tries/sleeps/tries/sleeps and the sleep could
 theoretically sleep past the rc.d/btconfig stage and the controller
 would remain unconfigured.

 So, I have prepared a different method for loading the firmware to
 Broadcom BCM2033 chip based devices. A package 'sysutils/bcmfw' will load
 the firmware files via a ugen(4) device interface.

 This update removes the ubtbcmfw(4) driver and adds a table to the ubt(4)
 driver so that it will not attach to Broadcom BCM2033 based devices before
 the firmware was loaded.

 This fixes kern/34219


 To generate a diff of this commit:
 cvs rdiff -r1.921 -r1.922 src/distrib/sets/lists/man/mi
 cvs rdiff -r1.399 -r1.400 src/share/man/man4/Makefile
 cvs rdiff -r1.1 -r1.2 src/share/man/man4/ubt.4
 cvs rdiff -r1.1 -r0 src/share/man/man4/ubtbcmfw.4
 cvs rdiff -r1.209 -r1.210 src/sys/dev/DEVNAMES
 cvs rdiff -r1.9 -r1.10 src/sys/dev/usb/FILES
 cvs rdiff -r1.68 -r1.69 src/sys/dev/usb/files.usb
 cvs rdiff -r1.14 -r1.15 src/sys/dev/usb/ubt.c
 cvs rdiff -r1.13 -r0 src/sys/dev/usb/ubtbcmfw.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Matthias Scheler <tron@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/34219 CVS commit: [netbsd-4] src
Date: Fri, 25 Aug 2006 12:33:58 +0000 (UTC)

 Module Name:	src
 Committed By:	tron
 Date:		Fri Aug 25 12:33:58 UTC 2006

 Modified Files:
 	src/distrib/sets/lists/man [netbsd-4]: mi
 	src/share/man/man4 [netbsd-4]: Makefile ubt.4
 	src/sys/dev [netbsd-4]: DEVNAMES
 	src/sys/dev/usb [netbsd-4]: FILES files.usb ubt.c
 Removed Files:
 	src/share/man/man4 [netbsd-4]: ubtbcmfw.4
 	src/sys/dev/usb [netbsd-4]: ubtbcmfw.c

 Log Message:
 Pull up following revision(s) (requested by plunky in ticket #49):
 	share/man/man4/Makefile: revision 1.400
 	sys/dev/usb/FILES: revision 1.10
 	sys/dev/usb/files.usb: revision 1.69
 	share/man/man4/ubt.4: revision 1.2
 	sys/dev/usb/ubt.c: revision 1.15
 	share/man/man4/ubtbcmfw.4: file removal
 	distrib/sets/lists/man/mi: revision 1.922
 	sys/dev/DEVNAMES: revision 1.210
 	sys/dev/usb/ubtbcmfw.c: file removal
 The ubtbcmfw(4) driver fails to compile, as noted by PR kern/34219.
 While it can be made to compile, the paradigm is not quite right because
 it attempts to contact the filesystem during autoconfig which sometimes
 causes a panic. Even if that was fixed, there is another potential problem
 in that the driver tries/sleeps/tries/sleeps and the sleep could
 theoretically sleep past the rc.d/btconfig stage and the controller
 would remain unconfigured.
 So, I have prepared a different method for loading the firmware to
 Broadcom BCM2033 chip based devices. A package 'sysutils/bcmfw' will load
 the firmware files via a ugen(4) device interface.
 This update removes the ubtbcmfw(4) driver and adds a table to the ubt(4)
 driver so that it will not attach to Broadcom BCM2033 based devices before
 the firmware was loaded.
 This fixes kern/34219


 To generate a diff of this commit:
 cvs rdiff -r1.917 -r1.917.2.1 src/distrib/sets/lists/man/mi
 cvs rdiff -r1.397 -r1.397.2.1 src/share/man/man4/Makefile
 cvs rdiff -r1.1 -r1.1.2.1 src/share/man/man4/ubt.4
 cvs rdiff -r1.1 -r0 src/share/man/man4/ubtbcmfw.4
 cvs rdiff -r1.208 -r1.208.2.1 src/sys/dev/DEVNAMES
 cvs rdiff -r1.9 -r1.9.2.1 src/sys/dev/usb/FILES
 cvs rdiff -r1.68 -r1.68.2.1 src/sys/dev/usb/files.usb
 cvs rdiff -r1.14 -r1.14.2.1 src/sys/dev/usb/ubt.c
 cvs rdiff -r1.13 -r0 src/sys/dev/usb/ubtbcmfw.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.