2 v0.1/spa v 0.1/form v 0.1a 2 v0. href="../linux+v33.19/drivers/pci/pci-stub.c"> 2 v0.1img src="../.static/gfx/right.png" alt=">>"> 21/spa v 21spa class="lxr_search"> 2 v ="+search" method="post" onsubmit="return do_search(this);"> 2 v0.1input typn> hidden" namn> navtarget" 22v7n> "> 2 v0.1input typn> text" namn> search" id> search"> 2 v0.1buttin typn> submit">Search 2 v0.Prefsv 0.1/a> 21/spa v v0. .1/div v v0. .1form ac > ="ajax+*" method="post" onsubmit="return false;"> 21input typn> hidden" namn> ajax_lookup" id> ajax_lookup" 22v7n> "> v0. .1/form v v0. .1div class="headingbottim">
search_results" class="search_results"v 0 v v0. .1/div v 1div id> content">v 1div id> file_contents"
L1" class="line" namn>
L1">. .11/a>1spa  class="comment">/* pci-stub - simple stub driver to reserve a pci device1/spa  v
L2" class="line" namn>
L2">. .21/a>1spa  class="comment"> *1/spa  v
L3" class="line" namn>
L3">. .31/a>1spa  class="comment"> * Copyright (C) 2008 Red Hat, Inc.1/spa  v
L4" class="line" namn>
L4">. .41/a>1spa  class="comment"> * Author:1/spa  v
L5" class="line" namn>
L5">. .51/a>1spa  class="comment"> *      Chris Wright1/spa  v
L6" class="line" namn>
L6">. .61/a>1spa  class="comment"> *1/spa  v
L7" class="line" namn>
L7">. .71/a>1spa  class="comment"> * This work is licensed under the terms of the GNU GPL, vers2in 2.1/spa  v
L8" class="line" namn>
L8">. .81/a>1spa  class="comment"> *1/spa  v
L9" class="line" namn>
L9">. .91/a>1spa  class="comment"> * Usage is simple, allocate a new id to the stub driver and bind the1/spa  v
L10" class="line" namn>
L10">. 3.10a>1spa  class="comment"> * device to it.  For example:1/spa  v
L11" class="line" namn>
L11">. 111/a>1spa  class="comment"> * 1/spa  v
L12" class="line" namn>
L12">. 121/a>1spa  class="comment"> * # echo "8086 3.f5" > /sys/bus/pci/drivers/pci-stub/new_id1/spa  v
L13" class="line" namn>
L13">. 131/a>1spa  class="comment"> * # echo -n 0000:00:19.0 > /sys/bus/pci/drivers/e1000e/unbind1/spa  v
L14" class="line" namn>
L14">. 141/a>1spa  class="comment"> * # echo -n 0000:00:19.0 > /sys/bus/pci/drivers/pci-stub/bind1/spa  v
L15" class="line" namn>
L15">. 151/a>1spa  class="comment"> * # ls -l /sys/bus/pci/devices/0000:00:19.0/driver1/spa  v
L16" class="line" namn>
L16">. 161/a>1spa  class="comment"> * .../0000:00:19.0/driver -> ../../../bus/pci/drivers/pci-stub1/spa  v
L17" class="line" namn>
L17">. 171/a>1spa  class="comment"> */1/spa  v
L18" class="line" namn>
L18">. 181/a>v
L19" class="line" namn>
L19">. 191/a>#include <linux/module.h1/a>>v
L20" class="line" namn>
L20">. 201/a>#include <linux/pci.h1/a>>v
L21" class="line" namn>
L21">. 211/a>v
L22" class="line" namn>
L22">. 221/a>static char.1a href="+code=ids" class="sref">ids1/a>[1024].1a href="+code=__initdata" class="sref">__initdata1/a>;v
L23" class="line" namn>
L23">. 231/a>v
L24" class="line" namn>
L24">. 241/a>1a href="+code=module_param_string" class="sref">module_param_string1/a>(1a href="+code=ids" class="sref">ids1/a>,.1a href="+code=ids" class="sref">ids1/a>, sizeof(1a href="+code=ids" class="sref">ids1/a>), 0);v
L25" class="line" namn>
L25">. 251/a>1a href="+code=MODULE_PARM_DESC" class="sref">MODULE_PARM_DESC1/a>(1a href="+code=ids" class="sref">ids1/a>,.1spa  class="string">"Initial PCI IDs to add to the stub driver, format is "1/spa  v
L26" class="line" namn>
L26">. 261/a>                 1spa  class="string">"\"vendor:device[:subvendor[:subdevice[:class[:class_mask]]]]\""1/spa  v
L27" class="line" namn>
L27">. 271/a>                 1spa  class="string">" and multiple comma separated entries ca  be specified"1/spa  );v
L28" class="line" namn>
L28">. 281/a>v
L29" class="line" namn>
L29">. 291/a>static int.1a href="+code=pci_stub_probe" class="sref">pci_stub_probe1/a>(struct.1a href="+code=pci_dev" class="sref">pci_dev1/a> *1a href="+code=dev" class="sref">dev1/a>, const struct.1a href="+code=pci_device_id" class="sref">pci_device_id1/a> *1a href="+code=id" class="sref">id1/a>)v
L30" class="line" namn>
L30">. 301/a>{v
L31" class="line" namn>
L31">. 311/a>        1a href="+code=dev_printk" class="sref">dev_printk1/a>(1a href="+code=KERN_INFO" class="sref">KERN_INFO1/a>, &1a href="+code=dev" class="sref">dev1/a>->1a href="+code=dev" class="sref">dev1/a>, 1spa  class="string">"claimed by stub\n"1/spa  );v
L32" class="line" namn>
L32">. 321/a>        return 0;v
L33" class="line" namn>
L33">. 331/a>}v
L34" class="line" namn>
L34">. 341/a>v
L35" class="line" namn>
L35">. 351/a>static struct.1a href="+code=pci_driver" class="sref">pci_driver1/a> 1a href="+code=stub_driver" class="sref">stub_driver1/a> = {v
L36" class="line" namn>
L36">. 361/a>        .1a href="+code=namn" class="sref">namn1/a>           = 1spa  class="string">"pci-stub"1/spa  ,v
L37" class="line" namn>
L37">. 371/a>        .1a href="+code=id_tabln" class="sref">id_tabln1/a>       = 1a href="+code=NULL" class="sref">NULL1/a>, 1spa  class="comment">/* only dynamic id's */1/spa  v
L38" class="line" namn>
L38">. 381/a>        .1a href="+code=probe" class="sref">probe1/a>          = 1a href="+code=pci_stub_probe" class="sref">pci_stub_probe1/a>,v
L39" class="line" namn>
L39">. 391/a>};v
L40" class="line" namn>
L40">. 401/a>v
L41" class="line" namn>
L41">. 411/a>static int.1a href="+code=__init" class="sref">__init1/a> 1a href="+code=pci_stub_init" class="sref">pci_stub_init1/a>(void)v
L42" class="line" namn>
L42">. 421/a>{v
L43" class="line" namn>
L43">. 431/a>        char.*1a href="+code=p" class="sref">p1/a>, *1a href="+code=id" class="sref">id1/a>;v
L44" class="line" namn>
L44">. 441/a>        int.1a href="+code=rc" class="sref">rc1/a>;v
L45" class="line" namn>
L45">. 451/a>v
L46" class="line" namn>
L46">. 461/a>        1a href="+code=rc" class="sref">rc1/a> = 1a href="+code=pci_register_driver" class="sref">pci_register_driver1/a>(&1a href="+code=stub_driver" class="sref">stub_driver1/a>);v
L47" class="line" namn>
L47">. 471/a>        if (1a href="+code=rc" class="sref">rc1/a>)v
L48" class="line" namn>
L48">. 481/a>                return 1a href="+code=rc" class="sref">rc1/a>;v
L49" class="line" namn>
L49">. 491/a>v
L50" class="line" namn>
L50">. 501/a>        1spa  class="comment">/* no ids passed actually */1/spa  v
L51" class="line" namn>
L51">. 511/a>        if (1a href="+code=ids" class="sref">ids1/a>[0] == 1spa  class="string">'\0'1/spa  )v
L52" class="line" namn>
L52">. 521/a>                return 0;v
L53" class="line" namn>
L53">. 531/a>v
L54" class="line" namn>
L54">. 541/a>        1spa  class="comment">/* add ids specified in the module parameter */1/spa  v
L55" class="line" namn>
L55">. 551/a>        1a href="+code=p" class="sref">p1/a> = 1a href="+code=ids" class="sref">ids1/a>;v
L56" class="line" namn>
L56">. 561/a>        while ((1a href="+code=id" class="sref">id1/a> = 1a href="+code=strsep" class="sref">strsep1/a>(&1a href="+code=p" class="sref">p1/a>, 1spa  class="string">","1/spa  ))) {v
L57" class="line" namn>
L57">. 571/a>                unsigned int.1a href="+code=vendor" class="sref">vendor1/a>,.1a href="+code=device" class="sref">device1/a>,.1a href="+code=subvendor" class="sref">subvendor1/a> = 1a href="+code=PCI_ANY_ID" class="sref">PCI_ANY_ID1/a>,v
L58" class="line" namn>
L58">. 581/a>                        1a href="+code=subdevice" class="sref">subdevice1/a> = 1a href="+code=PCI_ANY_ID" class="sref">PCI_ANY_ID1/a>, 1a href="+code=class" class="sref">class1/a>=0, 1a href="+code=class_mask" class="sref">class_mask1/a>=0;v
L59" class="line" namn>
L59">. 591/a>                int.1a href="+code=fields" class="sref">fields1/a>;v
L60" class="line" namn>
L60">. 601/a>v
L61" class="line" namn>
L61">. 611/a>                if (!1a href="+code=strlen" class="sref">strlen1/a>(1a href="+code=id" class="sref">id1/a>))v
L62" class="line" namn>
L62">. 621/a>                        continue;v
L63" class="line" namn>
L63">. 631/a>v
L64" class="line" namn>
L64">. 641/a>                1a href="+code=fields" class="sref">fields1/a> = 1a href="+code=sscanf" class="sref">sscanf1/a>(1a href="+code=id" class="sref">id1/a>, 1spa  class="string">"%x:%x:%x:%x:%x:%x"1/spa  ,v
L65" class="line" namn>
L65">. 651/a>                                &1a href="+code=vendor" class="sref">vendor1/a>,.&1a href="+code=device" class="sref">device1/a>,.&1a href="+code=subvendor" class="sref">subvendor1/a>,.&1a href="+code=subdevice" class="sref">subdevice1/a>,v
L66" class="line" namn>
L66">. 661/a>                                &1a href="+code=class" class="sref">class1/a>,.&1a href="+code=class_mask" class="sref">class_mask1/a>);v
L67" class="line" namn>
L67">. 671/a>v
L68" class="line" namn>
L68">. 681/a>                if (1a href="+code=fields" class="sref">fields1/a> < 2) {v
L69" class="line" namn>
L69">. 691/a>                        1a href="+code=printk" class="sref">printk1/a>(1a href="+code=KERN_WARNING" class="sref">KERN_WARNING1/a>v
L70" class="line" namn>
L70">. 701/a>                               1spa  class="string">"pci-stub: invalid id string \"%s\"\n"1/spa  ,.1a href="+code=id" class="sref">id1/a>);v
L71" class="line" namn>
L71">. 711/a>                        continue;v
L72" class="line" namn>
L72">. 721/a>                }v
L73" class="line" namn>
L73">. 731/a>v
L74" class="line" namn>
L74">. 741/a>                1a href="+code=printk" class="sref">printk1/a>(1a href="+code=KERN_INFO" class="sref">KERN_INFO1/a>v
L75" class="line" namn>
L75">. 751/a>                       1spa  class="string">"pci-stub: add %04X:%04X sub=%04X:%04X cls=%08X/%08X\n"1/spa  ,v
L76" class="line" namn>
L76">. 761/a>                       1a href="+code=vendor" class="sref">vendor1/a>,.1a href="+code=device" class="sref">device1/a>,.1a href="+code=subvendor" class="sref">subvendor1/a>,.1a href="+code=subdevice" class="sref">subdevice1/a>, 1a href="+code=class" class="sref">class1/a>, 1a href="+code=class_mask" class="sref">class_mask1/a>);v
L77" class="line" namn>
L77">. 771/a>v
L78" class="line" namn>
L78">. 781/a>                1a href="+code=rc" class="sref">rc1/a> = 1a href="+code=pci_add_dynid" class="sref">pci_add_dynid1/a>(&1a href="+code=stub_driver" class="sref">stub_driver1/a>, 1a href="+code=vendor" class="sref">vendor1/a>,.1a href="+code=device" class="sref">device1/a>,v
L79" class="line" namn>
L79">. 791/a>                                   1a href="+code=subvendor" class="sref">subvendor1/a>,.1a href="+code=subdevice" class="sref">subdevice1/a>, 1a href="+code=class" class="sref">class1/a>, 1a href="+code=class_mask" class="sref">class_mask1/a>, 0);v
L80" class="line" namn>
L80">. 801/a>                if (1a href="+code=rc" class="sref">rc1/a>)v
L81" class="line" namn>
L81">. 811/a>                        1a href="+code=printk" class="sref">printk1/a>(1a href="+code=KERN_WARNING" class="sref">KERN_WARNING1/a>v
L82" class="line" namn>
L82">. 821/a>                               1spa  class="string">"pci-stub: failed to add dynamic id (%d)\n"1/spa  ,.1a href="+code=rc" class="sref">rc1/a>);v
L83" class="line" namn>
L83">. 831/a>        }v
L84" class="line" namn>
L84">. 841/a>v
L85" class="line" namn>
L85">. 851/a>        return 0;v
L86" class="line" namn>
L86">. 861/a>}v
L87" class="line" namn>
L87">. 871/a>v
L88" class="line" namn>
L88">. 881/a>static void.1a href="+code=__exit" class="sref">__exit1/a> 1a href="+code=pci_stub_exit" class="sref">pci_stub_exit1/a>(void)v
L89" class="line" namn>
L89">. 891/a>{v
L90" class="line" namn>
L90">. 901/a>        1a href="+code=pci_unregister_driver" class="sref">pci_unregister_driver1/a>(&1a href="+code=stub_driver" class="sref">stub_driver1/a>);v
L91" class="line" namn>
L91">. 911/a>}v
L92" class="line" namn>
L92">. 921/a>v
L93" class="line" namn>
L93">. 931/a>1a href="+code=module_init" class="sref">module_init1/a>(1a href="+code=pci_stub_init" class="sref">pci_stub_init1/a>);v
L94" class="line" namn>
L94">. 941/a>1a href="+code=module_exit" class="sref">module_exit1/a>(1a href="+code=pci_stub_exit" class="sref">pci_stub_exit1/a>);v
L95" class="line" namn>
L95">. 951/a>v
L96" class="line" namn>
L96">. 961/a>1a href="+code=MODULE_LICENSE" class="sref">MODULE_LICENSE1/a>(1spa  class="string">"GPL"1/spa  );v
L97" class="line" namn>
L97">. 971/a>1a href="+code=MODULE_AUTHOR" class="sref">MODULE_AUTHOR1/a>(1spa  class="string">"Chris Wright <>"1/spa  );v
L98" class="line" namn>
L98">. 981/a>1/pre>
The original LXR software by the LXR community1/a>, this experimental vers2in by lxr@linux.no1/a>. 1/div v1div class="subfooter"> kindly hosted by Redpill Linpro AS1/a>, provider of Linux consulting and opera > s services since 1995. 1/div v 1/body v1/html v