Re-enable ACENIC and STARFIRE with no-firmware reporting.
[releases.git] / deblob-check
index 3280b044d7eba1b533ab31d2ef4a308712a39354..b8ea7e8bbd5a107713adfd02d1a66ab63a19e219 100755 (executable)
@@ -1,13 +1,13 @@
 #! /bin/sh
 
-# deblob-check version 2009-01-23
+# deblob-check version 2009-02-12
 # Inspired in gNewSense's find-firmware script.
 # Written by Alexandre Oliva <lxoliva@fsfla.org>
 
 # Check http://www.fsfla.org/svn/fsfla/software/linux-libre for newer
 # versions.
 
-# Copyright (C) 2008, 2009 Alexandre Oliva
+# Copyright 2008, 2009 Alexandre Oliva <lxoliva@fsfla.org>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -570,27 +570,13 @@ set_except () {
     badx "$1" $2
   }
 
-  blobna "request_firmware\\(_nowait\\)\\?"
+  blobna "request_firmware_nowait"
+  blobna "request_firmware"
+  blobna "request_ihex_firmware"
+  blobna "MODULE_FIRMWARE([^;]*)[^;]*;"
+  blobna "DEFAULT_FIRMWARE"
 
   case $prefix$1 in
-  /drivers/net/tg3.c)
-    # This file contains firmwares that we deblob with high
-    # sensitivity, so make sure the sequences of numbers that are not
-    # blobs are not deblobbed.  FIXME: we should have patterns to
-    # recognize the blobs instead.
-    defsnc '   static const u32 test_pat\[4\]\[6\] =' drivers/net/tg3.c
-    accept "   }\\(,\\? mem_tbl_5\\(70x\\|705\\|755\\|906\\)\\[\\] = {$sepx$blobpat*$sepx}\\)*;" drivers/net/tg3.c
-    ;;
-
-  ---/drivers/media/video/gspca/conex.c)
-    # FIXME: we shouldn't have to duplicate this here, but deblob
-    # doesn't pass us a pathname that matches linux-*.*.*/, and then
-    # we end up deblobbing false positives.
-    defsnc 'static const __u8 cx_inits_\(176\|320\|352\|640\)\[\] =' drivers/media/video/gspca/conex.c
-    defsnc 'static const __u8 cx_jpeg_init\[\]\[8\] =' drivers/media/video/gspca/conex.c
-    defsnc 'static const __u8 cxjpeg_\(640\|352\|320\|176\|qtable\)\[\]\[8\] =' drivers/media/video/gspca/conex.c
-    ;;
-
   */*linux*.tar* | */*kernel*.tar* | */*linux-*.*.*/*)
     # false alarms, contain source
     # drivers/net/wan/wanxlfw.inc_shipped -> wanxlfw.S
@@ -665,6 +651,13 @@ set_except () {
     defsnc 'static const char zr360[56]0_dqt\[0x86\] =' 'drivers/media/video/zr36060\.c\|drivers/media/video/zoran/zr36060\.c'
     defsnc 'static u8 tas3004_treble_table\[\] =' sound/aoa/codecs/tas-basstreble.h
 
+    # This file contains firmwares that we deblob with high
+    # sensitivity, so make sure the sequences of numbers that are not
+    # blobs are not deblobbed.  FIXME: we should have patterns to
+    # recognize the blobs instead.
+    defsnc '   static const u32 test_pat\[4\]\[6\] =' drivers/net/tg3.c
+    accept "   }\\(,\\? mem_tbl_5\\(70x\\|705\\|755\\|906\\)\\[\\] = {$sepx$blobpat*$sepx}\\)*;" drivers/net/tg3.c
+
     # end of generic checked expressions.
     # version-specific checked bits start here
 
@@ -828,6 +821,124 @@ set_except () {
     defsnc 'static u8 stv0288_inittab\[\] =' drivers/media/dvb/frontends/stv0288.c
     defsnc 'static const struct rf_channel rf_vals_b\[\] =' drivers/net/wireless/rt2x00/rt2400pci.c
 
+    # request_firmware matches for 2.6.28
+    accept 'D: Firmware loader (request_firmware)' CREDITS
+    accept 'FIRMWARE LOADER (request_firmware)' MAINTAINERS
+    accept '   - request_firmware() hotplug interface info.' Documentation/00-INDEX
+    accept 'This driver requires a patch for firmware_class[^\n]*[\n]request_firmware_nowait function\.' Documentation/dell_rbu.txt
+    accept ' request_firmware() hotplug interface:[\n] --*[\n].* - request_firmware_nowait() is also provided for convenience' Documentation/firmware_class/README
+    accept 'Still, there are kernel threads that may want.*For example, if request_.*_firmware() will fail regardless' Documentation/power/freezing-of-tasks.txt
+    accept 'Also, there may be some operations,.*calling request_firmware() from their .resume() routines' Documentation/power/notifiers.txt
+    accept 'There is an USB interface for downloading[/]uploading.*request_firmware interface\.' Documentation/video4linux/si470x.txt
+    accept '[\t]- move firmware loading to request_firmware()' drivers/staging/slicoss/README
+    accept 'config FIRMWARE_IN_KERNEL.*let firmware be loaded from userspace\.' drivers/base/Kconfig
+    accept 'static int[\n]_request_firmware(const struct firmware \*\*firmware_p, const char \*name,[^{]*[\n]{[\n]\([^}]\|[^\n}]}*\)*[\n]}[\n]' drivers/base/firmware_class.c
+    accept 'static int[\n]request_firmware_work_func(void \*arg)[\n]{[\n]\([^}]\|[^\n}]}*\)*ret = _request_firmware(\([^}]\|[^\n}]}*\)*[\n]}[\n]' drivers/base/firmware_class.c
+    accept '[/][*][*][\n] [*] request_firmware: - send firmware [^{]*[\n]{[\n]\([^}]\|[^\n}]}*\)*[\n]}[\n]' drivers/base/firmware_class.c
+    accept '[/][*][*][\n] [*] request_firmware_nowait: asynchronous version[^{]*[\n]{[\n]\([^}]\|[^\n}]}*\)*[\n]}[\n]' drivers/base/firmware_class.c
+    accept 'EXPORT_SYMBOL(request_firmware\(_nowait\)\?);' drivers/base/firmware_class.c
+    accept 'int request_firmware\(_nowait\)\?([^;]*);' include/linux/firmware.h
+    accept 'static inline int request_firmware\(_nowait\)\?([^{]*)[\n]{[\n][\t]return -EINVAL;[\n]}[\n]' include/linux/firmware.h
+    accept 'static inline int \(maybe_\)\?reject_firmware\(_nowait\)\?([^{;]*)[\n]{[\n]\([^}]\|[^\n}]}*\)*[\n]}[\n]' include/linux/firmware.h
+
+    accept 'static inline int request_ihex_firmware\?([^{]*)[\n]{[\n]\([^}]\|[^\n}]}*\)*[\n]}[\n]' include/linux/ihex.h
+    ocomment '[/][*] Optional firmware\([^\n]*[\n] [*]\)*[^\n]* MODULE_FIRMWARE()'
+    oprepline '#define MODULE_FIRMWARE(_firmware)' include/linux/module.h
+    accept ' [*] Sample code on how to use request_firmware() from drivers\.' samples/firmware_class/firmware_sample_driver.c
+    accept '[\t]\(retval\|error\) = request_firmware\(_nowait\)\?([^;]*"sample_driver_fw",[^;]*);' samples/firmware_class/firmware_sample_driver.c
+    ocomment ' [/][*] request_firmware blocks until userspace finished' samples/firmware_class/firmware_sample_driver.c
+    accept '           [ \t]*" request_firmware_nowait failed' samples/firmware_class/firmware_sample_driver.c
+
+    # We used to remove these in early versions of Linux-libre.
+    # They're now believed to be mere initialization data, rather than
+    # code disguised as such, and they're not long enough so as to
+    # render the software non-Free.
+    defsnc 'static u8 tda10021_inittab\[0x40\]=' drivers/media/dvb/frontends/tda10021.c
+    defsnc 'static u8 tda8083_init_tab \[\] =' drivers/media/dvb/frontends/tda8083.c
+    defsnc 'static u8 ves1820_inittab\[\] =' drivers/media/dvb/frontends/ves1820.c
+    defsnc 'static u8 init_1[89]93_w\?tab \?\[\] =' drivers/media/dvb/frontends/ves1x93.c
+    defsnc 'static const u8 saa7113_tab\[\] =' drivers/media/dvb/ttpci/budget-av.c
+    defsnc 'static u8 philips_sd1878_inittab\[\] =' drivers/media/dvb/ttpci/budget-av.c
+    defsnc 'const struct Kiara_table_entry Kiara_table\[PSZ_MAX\]\[6\]\[4\] =' drivers/media/video/pwc/pwc-kiara.c
+    defsnc 'const unsigned int KiaraRomTable \[8\]\[2\]\[16\]\[8\] =' drivers/media/video/pwc/pwc-kiara.c
+    defsnc 'const struct Timon_table_entry Timon_table\[PSZ_MAX\]\[PWC_FPS_MAX_TIMON\]\[4\] =' drivers/media/video/pwc/pwc-timon.c
+    defsnc 'const unsigned int TimonRomTable \[16\]\[2\]\[16\]\[8\] =' drivers/media/video/pwc/pwc-timon.c
+    defsnc '   static const struct struct_initData initData\[\] =' drivers/media/video/usbvideo/ibmcam.c
+    defsnc 'static const u8 rtl8187b_reg_table\[\]\[3\] =' drivers/net/wireless/rtl8187_dev.c
+
+    # Hunting down non-Free firmware-loading code and instructions.
+
+    blobna 'atmsar11\.fw' drivers/atm/ambassador.c
+
+    blob '    sprintf([^;]*fore200[^;]*FW_EXT[^;]*);' drivers/atm/fore200e.c
+    blobna '\(pc\|sb\)a200e\(_ecd\)\?\.bin[12]?' drivers/atm/fore200e.c
+    blobna 'The supplied firmware images.*fore.*Rebuild and reinstall[^.]*\.' Documentation/networking/fore200e.txt
+
+    blobna 'intelliport2\.bin' drivers/char/ip2/ip2main.c
+
+    blob 'static unsigned char warp_g[24]00_t2\?gzs\?a\?f\?\[\] = {[^{};]*};\([\n][\n]*static unsigned char warp_g[24]00_t2\?gzs\?a\?f\?\[\] = {[^{};]*};\)*' drivers/gpu/drm/mga/mga_ucode.h
+    blob '#define \(MGA_WARP_CODE_ALIGN\|WARP_UCODE_\(SIZE\|INSTALL\)\)\([^\n]*\\[     ]*[\n]\)*[^\n]*' drivers/gpu/drm/mga/mga_warp.c
+    blob 'static const unsigned int mga_warp_g[24]00_microcode_size =[^;]*;' drivers/gpu/drm/mga/mga_warp.c
+    blob 'static int mga_warp_install_g[24]00_microcode([^{]*)[\n]{[\n]\([^}]\|[^\n}]}*\)*[\n]}[\n]' drivers/gpu/drm/mga/mga_warp.c
+    blobna '\(case MGA_CARD_TYPE_G[^:]*:[      \n]*\)\+return [^;]*mga_warp[^;]*microcode[^;]*;\([     \n]*\(case MGA_CARD_TYPE_G[^:]*:[       \n]*\)\+return [^;]*mga_warp[^;]*microcode[^;]*;[       ]*\)*' drivers/gpu/drm/mga/mga_warp.c
+
+    blob 'static u32 r128_cce_microcode\[\] = {[^{};]*};' drivers/gpu/drm/r128/r128_cce.c
+    blob 'static void r128_cce_load_microcode([^{]*)[\n]{[\n]\([^}]\|[^\n}]}*\)*[\n]}[\n]' drivers/gpu/drm/r128/r128_cce.c
+    blob '     r128_cce_load_microcode([^;]*);' drivers/gpu/drm/r128/r128_cce.c
+
+    blob 'static const u32 R[S0-9]*0_cp_microcode\[\]\[2\] = {[^{};]*};\([\n][\n]*static const u32 R[S0-9]*0_cp_microcode\[\]\[2\] = {[^{};]*};\)*' drivers/gpu/drm/radeon/radeon_microcode.h
+    blob 'static void radeon_cp_load_microcode([^{]*)[\n]{[\n]\([^}]\|[^\n}]}*\)*[\n]}[\n]' drivers/gpu/drm/radeon/radeon_cp.c
+    blob '     radeon_cp_load_microcode([^;]*);' drivers/gpu/drm/radeon/radeon_cp.c
+
+    blob 'sub \(sp887[0x]\|tda1004\(5\|6\(lifeview\)\?\)\|av7110\|dec\(2\(00\|54\)0t\|3000s\)\|opera1\|vp7041\|dibusb\|nxt200[24]\|or51\(211\|132_\(qam\|vsb\)\)\|bluebird\) *{\([^}]*\|[^\n]}*\)[\n]}' Documentation/dvb/get_dvb_firmware
+    blobna 'Please use[^\n]*firmware[^\n]*sp887x[^\n]*\([\n][^\n]\+\)\+' Documentation/dvb/avermedia.txt
+    blob 'To extract the firmware[^\n]*Opera DVB-S1 USB-Box.*\/lib\/firmware\/ \.' Documentation/dvb/opera-firmware.txt
+    blobna '\(dvb-usb-opera[^\n]*\.fw\|2830S[^\n]*2\.sys\)' Documentation/dvb/opera-firmware.txt
+    blob 'Getting the Firmware\([\n][^\n]\+\)*' Documentation/dvb/ttusb-dec.txt
+
+    blob '\/\*[\n      ]*File automatically generated by createinit\.py using data[\n  ]*extracted from AF05BDA\.sys.*};' drivers/media/dvb/dvb-usb/af9005-script.h
+    blob '#include "af9005-script\.h"' drivers/media/dvb/dvb-usb/af9005-fe.c
+    blobna '[\n]       scriptlen = sizeof(script)[^;]*;[\n]    for[^{]*scriptlen[^{]*{[^}]*[^\n        }]' drivers/media/dvb/dvb-usb/af9005-fe.c
+
+    accept 'struct \(sp8870\|tda1004x\)_config[\n]{[^}]*(\*request_firmware)[^}]*[\n]};' 'drivers/media/dvb/frontends/\(sp8870\|tda1004x\)\.h'
+    blob '[/][*]\([^/]*\|[^*][/]\)*get_dvb_firmware\([^/]*\|[^*/][/]*\)*[*][/]\([\n]#define \(\([^\n   ]*_DEFAULT\|NONFREE\)_FIRMWARE\|"[^"]*"\) \([^\n]*\|[\\][\n]\)*\)*' 'drivers/media/dvb/frontends/\(sp8870\|tda1004x\)\.c'
+    accept '[^\n]*->request_firmware([^{;]*NONFREE_FIRMWARE' 'drivers/media/dvb/frontends/\(sp8870\|tda1004x\)\.c'
+    blobna 'dvb-fe-sp8870\.fw' drivers/media/dvb/frontends/sp8870.c
+    blobna 'dvb-fe-tda1004[56]\.fw' drivers/media/dvb/frontends/tda1004x.c
+    accept '   if (state->config->request_firmware != NULL) {' drivers/media/dvb/ttpci/tda1004x.c
+
+    # This bootcode is actually Free Software under GPLv2, but since it's
+    # being distributed without source code, we're taking it out.
+    blob 'static u8 bootcode\[\] = {[^}]*};' drivers/media/dvb/ttpci/av7110_hw.c
+    blobna 'dvb-ttpci-01\.fw' drivers/media/dvb/ttpci/av7110.c
+    accept '\(static int\|     \.request_firmware =\) alps_tdlb7_request_firmware[(,]' drivers/media/dvb/ttpci/av7110.c
+    defsnc 'static u8 nexusca_stv0297_inittab\[\] =' drivers/media/dvb/ttpci/av7110.c
+
+    accept '\(static int\|     \.request_firmware =\) alps_tdhd1_204_request_firmware[(,]' drivers/media/dvb/ttpci/budget.c
+
+    accept '\(static int\|     \.request_firmware =\) philips_tu1216_request_firmware[(,]' drivers/media/dvb/ttpci/budget-av.c
+
+    accept '\(static int\|     \.request_firmware =\) philips_tdm1316l_request_firmware[(,]' drivers/media/dvb/ttpci/budget-ci.c
+    defsnc 'static u8 philips_su1278_tt_inittab\[\] =' drivers/media/dvb/ttpci/budget-ci.c
+    defsnc 'static u8 dvbc_philips_tdm1316l_inittab\[\] =' drivers/media/dvb/ttpci/budget-ci.c
+    accept '\(static int\|     \.request_firmware =\) philips_tdm1316l_request_firmware[(,]' drivers/media/dvb/ttpci/budget-ci.c
+
+    blobna 'ttusb-budget\/dspbootcode\.bin' drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
+
+    blobna 'cpia2\/stv0672_vp4\.bin' drivers/media/video/cpia2/cpia2_core.c
+
+    blobna 'dabusb\/\(firmware\.fw\|bitstream\.bin\)' drivers/media/video/dabusb.c
+
+    blob 'static u32 tigon2\?Fw\(Text\|Rodata\|Data\)\[(MAX_\(TEXT\|RODATA\|DATA\)_LEN\/4) + 1\] __devinitdata = {[^}]*};\([\n]static u32 tigon2\?Fw\(Text\|Rodata\|Data\)\[(MAX_\(TEXT\|RODATA\|DATA\)_LEN\/4) + 1\] __devinitdata = {[^}]*};\)*' drivers/net/acenic_firwmare.h
+    blob '#define tigon2\?Fw[^ ]*\(Addr\|Len\) 0x[^\n]*\([\n]#define tigon2\?Fw[^ ]*\(Addr\|Len\) 0x[^\n]*\)\+' drivers/net/acenic_firmware.h
+    blob '\([/][*]\([^/]*\|[^*/][/]*\)*Do not try to clear\([^/]*\|[^*/][/]*\)*[*][/][\n]      \)\?ace_clear[^;]*;[\n]\([^}]*{[^}]*ace_copy[^}]*tigon2\?Fw[^}]*}\)*[\n]\+      return 0;[\n]}'
+
+    blob '#include "starfire_firmware\.h"' drivers/net/starfire.c
+    blob '[/][*]\([^/]*\|[^*/][/]*\)*Load Rx\/Tx firmware\([^/]*\|[^*/][/]*\)*[*][/]\([\n]     for ([^)]*FIRMWARE_[RT]X_SIZE[^)]*)[\n]         writel[^;]*firmware_[rt]x[^;]*;\)\+' drivers/net/starfire.c
+
+    blobna '\(agere\|prism\)_\(sta\|ap\)_fw\.bin' drivers/net/wireless/orinoco.c
+    blobna 'symbol_sp24t_\(prim\|sec\)_fw' drivers/net/wireless/orinoco.c
+
     # This looks suspicious, but it pretty much just sets stuff to zero.
     initnc 'static __u8 mode8420\(pro\|con\)\[\] =' drivers/media/video/cs8420.h
 
@@ -1648,7 +1759,7 @@ g;
   fi
 
   sedmain="
-/^;[/][*]\\(end .*\\)\\?[*][/];$/{
+/^[\n]\?;[/][*]\\(end .*\\)\\?[*][/];$/{
   $4;
   d;
 }
@@ -2206,7 +2317,7 @@ check () {
   # Extract or otherwise munge...
   case /$input in
   *.tar*)
-    cmd="tar -xf - --to-command='echo \";/*begin \$TAR_FILENAME*/;\"; cat; echo \";/**/;\"; echo \";/*end \$TAR_FILENAME*/;\"'"
+    cmd="tar -xf - --to-command='echo \";/*begin \$TAR_FILENAME*/;\"; cat; echo \";/**/;\"; echo; echo \";/*end \$TAR_FILENAME*/;\"'"
     ;;
   *.patch | *.patch.*z* | */patch-* | *.diff | *.diff.*z*)
     if $reverse_patch; then
@@ -2231,7 +2342,7 @@ check () {
     cmd='cat'
     ;;
   esac
-  cmd="{ echo \";/*begin $input*/;\"; $cmd; echo \";/*end $input*/;\"; }"
+  cmd="{ echo \";/*begin $input*/;\"; $cmd; echo; echo \";/*end $input*/;\"; }"
   set "$@" "$cmd"
 
   case $input in