/*
- * $Id: access.c,v 1.2 1999/01/24 21:35:35 mj Exp $
- *
* The PCI Library -- User Access
*
- * Copyright (c) 1997--1999 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+ * Copyright (c) 1997--2003 Martin Mares <mj@ucw.cz>
*
* Can be freely distributed and used under the terms of the GNU GPL.
*/
static struct pci_methods *pci_methods[PCI_ACCESS_MAX] = {
NULL,
-#ifdef HAVE_PM_LINUX_PROC
- &pm_linux_proc,
+#ifdef PCI_HAVE_PM_LINUX_SYSFS
+ &pm_linux_sysfs,
#else
NULL,
#endif
-#ifdef HAVE_PM_SYSCALLS
- &pm_syscalls,
+#ifdef PCI_HAVE_PM_LINUX_PROC
+ &pm_linux_proc,
#else
NULL,
#endif
-#ifdef HAVE_PM_INTEL_CONF
+#ifdef PCI_HAVE_PM_INTEL_CONF
&pm_intel_conf1,
&pm_intel_conf2,
#else
NULL,
NULL,
#endif
-#ifdef HAVE_PM_DUMP
+#ifdef PCI_HAVE_PM_FBSD_DEVICE
+ &pm_fbsd_device,
+#else
+ NULL,
+#endif
+#ifdef PCI_HAVE_PM_AIX_DEVICE
+ &pm_aix_device,
+#else
+ NULL,
+#endif
+#ifdef PCI_HAVE_PM_NBSD_LIBPCI
+ &pm_nbsd_libpci,
+#else
+ NULL,
+#endif
+#ifdef PCI_HAVE_PM_DUMP
&pm_dump,
#else
NULL,
int i;
bzero(a, sizeof(*a));
- a->id_file_name = PATH_PCI_IDS;
+ a->id_file_name = PCI_PATH_IDS;
for(i=0; i<PCI_ACCESS_MAX; i++)
if (pci_methods[i] && pci_methods[i]->config)
pci_methods[i]->config(a);
}
static void
-pci_null_debug(char * UNUSED msg, ...)
+pci_null_debug(char *msg UNUSED, ...)
{
}
{
a->debug("...OK\n");
a->methods = pci_methods[i];
+ a->method = i;
break;
}
a->debug("...No.\n");
bzero(d, sizeof(*d));
d->access = a;
d->methods = a->methods;
+ d->hdrtype = -1;
if (d->methods->init_dev)
d->methods->init_dev(d);
return d;
}
struct pci_dev *
-pci_get_dev(struct pci_access *a, int bus, int dev, int func)
+pci_get_dev(struct pci_access *a, int domain, int bus, int dev, int func)
{
struct pci_dev *d = pci_alloc_dev(a);
+ d->domain = domain;
d->bus = bus;
d->dev = dev;
d->func = func;
return d->methods->write(d, pos, buf, len);
}
-void
+int
pci_fill_info(struct pci_dev *d, int flags)
{
if (flags & PCI_FILL_RESCAN)
d->known_fields = 0;
}
if (flags & ~d->known_fields)
- d->methods->fill_info(d, flags & ~d->known_fields);
- d->known_fields |= flags;
+ d->known_fields |= d->methods->fill_info(d, flags & ~d->known_fields);
+ return d->known_fields;
}
void