1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>pci_create_slot</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="The Linux Kernel API"><link rel="up" href="ch09s05.html" title="PCI Support Library"><link rel="prev" href="API-pci-rescan-bus.html" title="pci_rescan_bus"><link rel="next" href="API-pci-destroy-slot.html" title="pci_destroy_slot"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">pci_create_slot</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-pci-rescan-bus.html">Prev</a> </td><th width="60%" align="center">PCI Support Library</th><td width="20%" align="right"> <a accesskey="n" href="API-pci-destroy-slot.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-pci-create-slot"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>pci_create_slot — 2 create or increment refcount for physical PCI slot 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">struct pci_slot * <b class="fsfunc">pci_create_slot </b>(</code></td><td>struct pci_bus * <var class="pdparam">parent</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">slot_nr</var>, </td></tr><tr><td> </td><td>const char * <var class="pdparam">name</var>, </td></tr><tr><td> </td><td>struct hotplug_slot * <var class="pdparam">hotplug</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1127011492"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>parent</code></em></span></dt><dd><p> 4 struct pci_bus of parent bridge 5 </p></dd><dt><span class="term"><em class="parameter"><code>slot_nr</code></em></span></dt><dd><p> 6 PCI_SLOT(pci_dev->devfn) or -1 for placeholder 7 </p></dd><dt><span class="term"><em class="parameter"><code>name</code></em></span></dt><dd><p> 8 user visible string presented in /sys/bus/pci/slots/<name> 9 </p></dd><dt><span class="term"><em class="parameter"><code>hotplug</code></em></span></dt><dd><p> 10 set if caller is hotplug driver, NULL otherwise 11 </p></dd></dl></div></div><div class="refsect1"><a name="idp1127016436"></a><h2>Description</h2><p> 12 PCI slots have first class attributes such as address, speed, width, 13 and a <span class="structname">struct pci_slot</span> is used to manage them. This interface will 14 either return a new <span class="structname">struct pci_slot</span> to the caller, or if the pci_slot 15 already exists, its refcount will be incremented. 16 </p><p> 17 18 Slots are uniquely identified by a <em class="parameter"><code>pci_bus</code></em>, <em class="parameter"><code>slot_nr</code></em> tuple. 19 </p><p> 20 21 There are known platforms with broken firmware that assign the same 22 name to multiple slots. Workaround these broken platforms by renaming 23 the slots on behalf of the caller. If firmware assigns name N to 24</p></div><div class="refsect1"><a name="idp1127018956"></a><h2>multiple slots</h2><p> 25 </p><p> 26 27 The first slot is assigned N 28 The second slot is assigned N-1 29 The third slot is assigned N-2 30 etc. 31</p></div><div class="refsect1"><a name="idp1127019804"></a><h2>Placeholder slots</h2><p> 32 In most cases, <em class="parameter"><code>pci_bus</code></em>, <em class="parameter"><code>slot_nr</code></em> will be sufficient to uniquely identify 33 a slot. There is one notable exception - pSeries (rpaphp), where the 34 <em class="parameter"><code>slot_nr</code></em> cannot be determined until a device is actually inserted into 35 the slot. In this scenario, the caller may pass -1 for <em class="parameter"><code>slot_nr</code></em>. 36 </p><p> 37 38 The following semantics are imposed when the caller passes <em class="parameter"><code>slot_nr</code></em> == 39 -1. First, we no longer check for an existing <code class="constant">struct</code> pci_slot, as there 40 may be many slots with <em class="parameter"><code>slot_nr</code></em> of -1. The other change in semantics is 41 user-visible, which is the 'address' parameter presented in sysfs will 42</p></div><div class="refsect1"><a name="idp1127023420"></a><h2>consist solely of a dddd</h2><p> 43 bb tuple, where dddd is the PCI domain of the 44 <code class="constant">struct</code> pci_bus and bb is the bus number. In other words, the devfn of 45 the 'placeholder' slot will not be displayed. 46</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-pci-rescan-bus.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch09s05.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-pci-destroy-slot.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">pci_rescan_bus</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">pci_destroy_slot</span></td></tr></table></div></body></html> 47