Main Page | Modules | Data Structures | File List | Data Fields | Related Pages

PCI
[Linux 2.6 support]

PCI. More...

Defines

#define PCI_IDS_MAX_LINE_LEN   512
 Maximum length of lines in pci.ids.


Functions

void pci_ids_line_iter_init ()
 Initialize the pci.ids line iterator to the beginning of the file.

char * pci_ids_line_iter_get_line (unsigned int *line_len)
 Get the next line from pci.ids.

dbus_bool_t pci_ids_line_iter_has_more ()
 See if there are more lines to process in pci.ids.

void pci_ids_find (int vendor_id, int product_id, int subsys_vendor_id, int subsys_product_id, char **vendor_name, char **product_name, char **subsys_vendor_name, char **subsys_product_name)
 Find the names for a PCI device.

dbus_bool_t pci_ids_load (const char *path)
 Load the PCI database used for mapping vendor, product, subsys_vendor and subsys_product numbers into names.

dbus_bool_t pci_ids_free ()
 Free resources used by to store the PCI database.

char * pci_compute_udi (HalDevice *d, int append_num)
 This function will compute the device uid based on other properties of the device.

void pci_add_caps_from_class (HalDevice *d, int dev_class, int dev_sub_class, int dev_proto)
 Set capabilities from PCI class.

void visit_device_pci_got_parent (HalDevice *parent, void *data1, void *data2)
 Callback when the parent is found or if there is no parent..

void visit_device_pci (const char *path, struct sysfs_device *device)
 Visitor function for PCI device.

void linux_pci_init ()
 Init function for PCI handling.

void linux_pci_detection_done ()
 This function is called when all device detection on startup is done in order to perform optional batch processing on devices.

void linux_pci_shutdown ()
 Shutdown function for PCI handling.


Variables

char * pci_ids = NULL
 Pointer to where the pci.ids file is loaded.

unsigned int pci_ids_len
 Length of data store at at pci_ids.

unsigned int pci_ids_iter_pos
 Iterator position into pci_ids.


Detailed Description

PCI.


Function Documentation

void pci_add_caps_from_class HalDevice d,
int  dev_class,
int  dev_sub_class,
int  dev_proto
[static]
 

Set capabilities from PCI class.

This is a function from hell, maybe some searchable data-structure would be better...

Parameters:
d HalDevice to set caps on
dev_class device class
dev_sub_class device sub class
dev_proto device protocol

Definition at line 372 of file linux_pci.c.

References ds_add_capability(), ds_property_set_string(), and HalDevice.

Referenced by visit_device_pci().

char* pci_compute_udi HalDevice d,
int  append_num
[static]
 

This function will compute the device uid based on other properties of the device.

Specifically, the following properties are required:

  • pci.idVendor, pci.idProduct

Other properties may also be used.

Requirements for uid:

  • do not rely on bus, port etc.; we want this id to be as unique for the device as we can
  • make sure it doesn't rely on properties that cannot be obtained from the minimal information we can obtain on an unplug event

Parameters:
d HalDevice object
append_num Number to append to name if not -1
Returns:
New unique device id; only good until the next invocation of this function

Definition at line 345 of file linux_pci.c.

References ds_property_get_int(), and HalDevice.

Referenced by visit_device_pci_got_parent().

void pci_ids_find int  vendor_id,
int  product_id,
int  subsys_vendor_id,
int  subsys_product_id,
char **  vendor_name,
char **  product_name,
char **  subsys_vendor_name,
char **  subsys_product_name
[static]
 

Find the names for a PCI device.

The pointers returned are only valid until the next invocation of this function.

Parameters:
vendor_id PCI vendor id or 0 if unknown
product_id PCI product id or 0 if unknown
subsys_vendor_id PCI subsystem vendor id or 0 if unknown
subsys_product_id PCI subsystem product id or 0 if unknown
vendor_name Set to pointer of result or #NULL
product_name Set to pointer of result or #NULL
subsys_vendor_name Set to pointer of result or #NULL
subsys_product_name Set to pointer of result or #NULL

Definition at line 125 of file linux_pci.c.

References pci_ids_line_iter_get_line(), pci_ids_line_iter_has_more(), pci_ids_line_iter_init(), and PCI_IDS_MAX_LINE_LEN.

Referenced by visit_device_pci().

dbus_bool_t pci_ids_free  )  [static]
 

Free resources used by to store the PCI database.

Parameters:
#FALSE if the PCI database wasn't loaded

Definition at line 315 of file linux_pci.c.

References pci_ids.

Referenced by linux_pci_shutdown().

char* pci_ids_line_iter_get_line unsigned int *  line_len  )  [static]
 

Get the next line from pci.ids.

Parameters:
line_len Pointer to where number of bytes in line will be stored
Returns:
Pointer to the line; only valid until the next invocation of this function

Definition at line 78 of file linux_pci.c.

References pci_ids, pci_ids_iter_pos, pci_ids_len, and PCI_IDS_MAX_LINE_LEN.

Referenced by pci_ids_find().

dbus_bool_t pci_ids_line_iter_has_more  )  [static]
 

See if there are more lines to process in pci.ids.

Returns:
#TRUE iff there are more lines to process

Definition at line 104 of file linux_pci.c.

References pci_ids_iter_pos, and pci_ids_len.

Referenced by pci_ids_find().

dbus_bool_t pci_ids_load const char *  path  )  [static]
 

Load the PCI database used for mapping vendor, product, subsys_vendor and subsys_product numbers into names.

Parameters:
path Path of the pci.ids file, e.g. /usr/share/hwdata/pci.ids
Returns:
#TRUE if the file was succesfully loaded

Definition at line 278 of file linux_pci.c.

References DIE, pci_ids, and pci_ids_len.

Referenced by linux_pci_init().

void visit_device_pci const char *  path,
struct sysfs_device *  device
 

Visitor function for PCI device.

This function parses the attributes present and creates a new HAL device based on this information.

Parameters:
path Sysfs-path for device
device libsysfs object for device

Note:
We also set the path here, because otherwise we can't handle two identical devices per the algorithm used in a rename_and_merge()
The point is that we need something unique in the Bus namespace

Definition at line 651 of file linux_pci.c.

References drivers_lookup(), ds_device_async_find_by_key_value_string(), ds_device_new(), ds_property_set_int(), ds_property_set_string(), get_parent_sysfs_path(), HAL_LINUX_HOTPLUG_TIMEOUT, HalDevice, is_probing, parse_hex(), pci_add_caps_from_class(), pci_ids_find(), and visit_device_pci_got_parent().

Referenced by visit_device().

void visit_device_pci_got_parent HalDevice parent,
void *  data1,
void *  data2
[static]
 

Callback when the parent is found or if there is no parent..

This is where we get added to the GDL..

Parameters:
parent Async Return value from the find call
data1 User data
data2 User data

Definition at line 788 of file linux_pci.c.

References ds_device_find(), ds_gdl_add(), ds_property_set_string(), HalDevice, pci_compute_udi(), rename_and_merge(), and HalDevice_s::udi.

Referenced by visit_device_pci().


Generated on Thu Mar 11 21:32:27 2004 for HAL by doxygen 1.3.6-20040222