Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
slot.c File Reference
#include <linux/kobject.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/err.h>
#include "pci.h"

Go to the source code of this file.

Functions

 EXPORT_SYMBOL_GPL (pci_slots_kset)
 
: user visible string presented in /sys/bus/pci/slots/<name>

pci_create_slot - create or increment refcount for physical PCI slot : struct pci_bus of parent bridge : PCI_SLOT(pci_dev->devfn) or -1 for placeholder

: set if caller is hotplug driver, NULL otherwise

PCI slots have first class attributes such as address, speed, width, and a &struct pci_slot is used to manage them. This interface will either return a new &struct pci_slot to the caller, or if the pci_slot already exists, its refcount will be incremented.

Slots are uniquely identified by a , tuple.

There are known platforms with broken firmware that assign the same name to multiple slots. Workaround these broken platforms by renaming the slots on behalf of the caller. If firmware assigns name N to multiple slots:

The first slot is assigned N The second slot is assigned N-1 The third slot is assigned N-2 etc.

Placeholder slots: In most cases, , will be sufficient to uniquely identify a slot. There is one notable exception - pSeries (rpaphp), where the cannot be determined until a device is actually inserted into the slot. In this scenario, the caller may pass -1 for .

The following semantics are imposed when the caller passes == -1. First, we no longer check for an existing struct pci_slot, as there may be many slots with of -1. The other change in semantics is user-visible, which is the 'address' parameter presented in sysfs will consist solely of a dddd:bb tuple, where dddd is the PCI domain of the struct pci_bus and bb is the bus number. In other words, the devfn of the 'placeholder' slot will not be displayed.

struct pci_slotpci_create_slot (struct pci_bus *parent, int slot_nr, const char *name, struct hotplug_slot *hotplug)
 
 EXPORT_SYMBOL_GPL (pci_create_slot)
 
void pci_renumber_slot (struct pci_slot *slot, int slot_nr)
 
 EXPORT_SYMBOL_GPL (pci_renumber_slot)
 
void pci_destroy_slot (struct pci_slot *slot)
 
 EXPORT_SYMBOL_GPL (pci_destroy_slot)
 
 subsys_initcall (pci_slot_init)
 

Variables

struct ksetpci_slots_kset
 

Function Documentation

EXPORT_SYMBOL_GPL ( pci_slots_kset  )
EXPORT_SYMBOL_GPL ( pci_create_slot  )
EXPORT_SYMBOL_GPL ( pci_renumber_slot  )
EXPORT_SYMBOL_GPL ( pci_destroy_slot  )
struct pci_slot* pci_create_slot ( struct pci_bus parent,
int  slot_nr,
const char name,
struct hotplug_slot *  hotplug 
)
read

Definition at line 247 of file slot.c.

void pci_destroy_slot ( struct pci_slot slot)

pci_destroy_slot - decrement refcount for physical PCI slot : struct pci_slot to decrement

struct pci_slot is refcounted, so destroying them is really easy; we just call kobject_put on its kobj and let our release methods do the rest.

Definition at line 356 of file slot.c.

void pci_renumber_slot ( struct pci_slot slot,
int  slot_nr 
)

pci_renumber_slot - update struct pci_slot -> number : &struct pci_slot to update : new number for slot

The primary purpose of this interface is to allow callers who earlier created a placeholder slot in pci_create_slot() by passing a -1 as slot_nr, to update their struct pci_slot with the correct .

Definition at line 331 of file slot.c.

subsys_initcall ( pci_slot_init  )

Variable Documentation

struct kset* pci_slots_kset

Definition at line 15 of file slot.c.