118c2aff7Sartem /***************************************************************************
218c2aff7Sartem  *
318c2aff7Sartem  * devinfo_pci.c : PCI devices
418c2aff7Sartem  *
5*112cd14aSqz  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
618c2aff7Sartem  * Use is subject to license terms.
718c2aff7Sartem  *
818c2aff7Sartem  * Licensed under the Academic Free License version 2.1
918c2aff7Sartem  *
1018c2aff7Sartem  **************************************************************************/
1118c2aff7Sartem 
1292f38132Sartem #pragma ident	"%Z%%M%	%I%	%E% SMI"
1318c2aff7Sartem 
1400687e57Sartem #ifdef HAVE_CONFIG_H
1500687e57Sartem #  include <config.h>
1600687e57Sartem #endif
1700687e57Sartem 
1818c2aff7Sartem #include <stdio.h>
1918c2aff7Sartem #include <string.h>
2018c2aff7Sartem #include <libdevinfo.h>
2118c2aff7Sartem 
2218c2aff7Sartem #include "../osspec.h"
2318c2aff7Sartem #include "../logger.h"
2418c2aff7Sartem #include "../hald.h"
2518c2aff7Sartem #include "../hald_dbus.h"
2618c2aff7Sartem #include "../device_info.h"
2718c2aff7Sartem #include "../util.h"
2818c2aff7Sartem #include "../ids.h"
2918c2aff7Sartem #include "devinfo_pci.h"
3018c2aff7Sartem 
3118c2aff7Sartem HalDevice *devinfo_pci_add (HalDevice *parent, di_node_t node, char *devfs_path, char *device_type);
3218c2aff7Sartem 
3318c2aff7Sartem DevinfoDevHandler devinfo_pci_handler = {
3418c2aff7Sartem         devinfo_pci_add,
3518c2aff7Sartem 	NULL,
3618c2aff7Sartem 	NULL,
3718c2aff7Sartem 	NULL,
3818c2aff7Sartem 	NULL,
3918c2aff7Sartem         NULL
4018c2aff7Sartem };
4118c2aff7Sartem 
devinfo_pci_add(HalDevice * parent,di_node_t node,char * devfs_path,char * device_type)4218c2aff7Sartem HalDevice *devinfo_pci_add (HalDevice *parent, di_node_t node, char *devfs_path, char *device_type)
4318c2aff7Sartem {
4418c2aff7Sartem 	HalDevice *d;
4518c2aff7Sartem 	char	*s;
4618c2aff7Sartem 	int	*i;
4718c2aff7Sartem 	int	vid, pid, svid, spid;
4818c2aff7Sartem 
4918c2aff7Sartem 	if ((device_type == NULL) ||
5018c2aff7Sartem 	    ((strcmp (device_type, "pci") != 0) &&
5118c2aff7Sartem 	    (strcmp (device_type, "pci-ide") != 0))) {
5218c2aff7Sartem 		if (parent == NULL) {
53