Date: Mon, 1 May 2006 00:36:49 +0200 From: Max Laier <max@love2party.net> To: freebsd-current@freebsd.org Subject: Re: iwi driver Message-ID: <200605010036.56447.max@love2party.net> In-Reply-To: <200605010020.50468.max@love2party.net> References: <20060430125904.E7BF47000091@mwinf1306.wanadoo.fr> <4454F7AC.3070904@errno.com> <200605010020.50468.max@love2party.net>
next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart7401376.FPI4Ip6rWb Content-Type: multipart/mixed; boundary="Boundary-01=_CwTVErmKjF50z1V" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_CwTVErmKjF50z1V Content-Type: text/plain; charset="iso-8859-6" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Monday 01 May 2006 00:20, Max Laier wrote: > Here is a small patch to build a "debug.firmware" sysctl. Should give: > "iwi_bss/300/191142" for the latest firmware from net/iwi-firmware-kmod > > Any comments on the patch? Will commit shortly otherwise. =46orgot the patch. =2D-=20 /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News --Boundary-01=_CwTVErmKjF50z1V Content-Type: text/x-diff; charset="iso-8859-6"; name="firmware_debug.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="firmware_debug.diff" Index: subr_firmware.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /usr/store/mlaier/fcvs/src/sys/kern/subr_firmware.c,v retrieving revision 1.1 diff -u -r1.1 subr_firmware.c =2D-- subr_firmware.c 29 Jan 2006 02:52:41 -0000 1.1 +++ subr_firmware.c 30 Apr 2006 22:11:05 -0000 @@ -32,6 +32,8 @@ #include <sys/malloc.h> #include <sys/queue.h> #include <sys/taskqueue.h> +#include <sys/sbuf.h> +#include <sys/sysctl.h> #include <sys/systm.h> #include <sys/lock.h> #include <sys/mutex.h> @@ -41,6 +43,8 @@ #include <sys/proc.h> #include <sys/module.h> =20 +static int sysctl_debug_firmware(SYSCTL_HANDLER_ARGS); + #define FIRMWARE_MAX 30 static char *name_unload =3D "UNLOADING"; static struct firmware firmware_table[FIRMWARE_MAX]; @@ -48,6 +52,49 @@ struct mtx firmware_mtx; MTX_SYSINIT(firmware, &firmware_mtx, "firmware table", MTX_DEF); =20 +static int +sysctl_debug_firmware(SYSCTL_HANDLER_ARGS) +{ + struct firmware *fp; + struct sbuf sb; + int error, i, count =3D 0; + + for (i =3D 0; i < FIRMWARE_MAX; i++) { + fp =3D &firmware_table[i]; + if (fp->name !=3D NULL) + count++; + } + + if (count =3D=3D 0) + return (sysctl_handle_string(oidp, "NONE", 5, req)); + + sbuf_new(&sb, NULL, count * 32 + 2, SBUF_FIXEDLEN); + + sbuf_printf(&sb, "\n"); + + mtx_lock(&firmware_mtx); + for (i =3D 0; i < FIRMWARE_MAX; i++) { + fp =3D &firmware_table[i]; + if (fp->name !=3D NULL) { + if (count-- <=3D 0) + sbuf_printf(&sb, "...\n"); + else + sbuf_printf(&sb, "\t%16s/%u/%zi\n", fp->name, + fp->version, fp->datasize); + } + } + mtx_unlock(&firmware_mtx); + + sbuf_trim(&sb); + sbuf_finish(&sb); + error =3D sysctl_handle_string(oidp, sbuf_data(&sb), sbuf_len(&sb), req); + sbuf_delete(&sb); + + return (error); +} +SYSCTL_OID(_debug, OID_AUTO, firmware, CTLTYPE_STRING|CTLFLAG_RD, NULL, 0, + sysctl_debug_firmware, "A", "Loaded firmware images"); + /* * Register a firmware image with the specified name. The * image name must not already be registered. If this is a --Boundary-01=_CwTVErmKjF50z1V-- --nextPart7401376.FPI4Ip6rWb Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (FreeBSD) iD8DBQBEVTwIXyyEoT62BG0RAjFRAJ9ndok8R/2UD65y9hTVLZtatnsvIwCeIqbr cyIADGpdpJg/KvBQDbH7FyM= =HUlM -----END PGP SIGNATURE----- --nextPart7401376.FPI4Ip6rWb--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605010036.56447.max>