*
* \author Ian Romanick <idr@us.ibm.com>
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <stdlib.h>
#include <errno.h>
/**
* Initialize the PCI subsystem for access.
- *
+ *
* \return
* Zero on success or an errno value on failure. In particular, if no
* platform-specific initializers are available, \c ENOSYS will be returned.
pci_system_init( void )
{
int err = ENOSYS;
-
-#ifdef linux
+
+#ifdef __linux__
err = pci_system_linux_sysfs_create();
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
err = pci_system_freebsd_create();
err = pci_system_openbsd_create();
#elif defined(__sun)
err = pci_system_solx_devfs_create();
+#elif defined(__GNU__) || defined(__CYGWIN__)
+ err = pci_system_x86_create();
+#else
+# error "Unsupported OS"
#endif
return err;
/**
* Shutdown all access to the PCI subsystem.
- *
+ *
* \sa pci_system_init
*/
void
return;
}
+ pci_io_cleanup();
if ( pci_sys->devices ) {
for ( i = 0 ; i < pci_sys->num_devices ; i++ ) {
free( (char *) pci_sys->devices[i].device_string );
free( (char *) pci_sys->devices[i].agp );
-
+
pci_sys->devices[i].device_string = NULL;
pci_sys->devices[i].agp = NULL;
(*pci_sys->methods->destroy_device)( & pci_sys->devices[i].base );
}
}
-
+
free( pci_sys->devices );
pci_sys->devices = NULL;
pci_sys->num_devices = 0;
}
-
if ( pci_sys->methods->destroy != NULL ) {
(*pci_sys->methods->destroy)();
}
-
+
free( pci_sys );
pci_sys = NULL;
}