void free_pci_domain(struct pci_domain *domain);
struct match * find_pci_device(const struct pci_domain *pci_domain,
struct match *list);
-int get_name_from_pci_ids(struct pci_domain *pci_domain);
-int get_module_name_from_pci_ids(struct pci_domain *pci_domain);
-int get_class_name_from_pci_ids(struct pci_domain *pci_domain);
+int get_name_from_pci_ids(struct pci_domain *pci_domain, char *pciids_path);
+int get_module_name_from_pci_ids(struct pci_domain *pci_domain, char *modules_pcimap_path);
+int get_class_name_from_pci_ids(struct pci_domain *pci_domain, char *pciids_path);
#endif /* _SYS_PCI_H */
/* Try to match any pci device to the appropriate kernel module */
/* it uses the modules.pcimap from the boot device */
-int get_module_name_from_pci_ids(struct pci_domain *domain)
+int get_module_name_from_pci_ids(struct pci_domain *domain, char *modules_pcimap_path)
{
char line[MAX_LINE];
char module_name[21]; // the module name field is 21 char long
}
/* Opening the modules.pcimap (of a linux kernel) from the boot device */
- f=fopen("modules.pcimap", "r");
+ f=fopen(modules_pcimap_path, "r");
if (!f)
return -ENOMODULESPCIMAP;
/* Try to match any pci device to the appropriate class name */
/* it uses the pci.ids from the boot device */
-int get_class_name_from_pci_ids(struct pci_domain *domain)
+int get_class_name_from_pci_ids(struct pci_domain *domain, char *pciids_path)
{
char line[MAX_LINE];
char class_name[PCI_CLASS_NAME_SIZE];
}
/* Opening the pci.ids from the boot device */
- f = fopen("pci.ids","r");
+ f = fopen(pciids_path,"r");
if (!f)
return -ENOPCIIDS;
/* Try to match any pci device to the appropriate vendor and product name */
/* it uses the pci.ids from the boot device */
-int get_name_from_pci_ids(struct pci_domain *domain)
+int get_name_from_pci_ids(struct pci_domain *domain, char *pciids_path)
{
char line[MAX_LINE];
char vendor[PCI_VENDOR_NAME_SIZE];
}
/* Opening the pci.ids from the boot device */
- f = fopen("pci.ids","r");
+ f = fopen(pciids_path,"r");
if (!f)
return -ENOPCIIDS;
printf("PCI: Looking for device name\n");
/* Assigning product & vendor name for each device*/
- return_code=get_name_from_pci_ids(pci_domain);
+ return_code=get_name_from_pci_ids(pci_domain,"pci.ids");
if (return_code == -ENOPCIIDS) {
printf("PCI: ERROR !\n");
printf("PCI: Unable to open pci.ids in the same directory as pcitest.c32.\n");
printf("PCI: Resolving class names\n");
/* Assigning class name for each device*/
- return_code=get_class_name_from_pci_ids(pci_domain);
+ return_code=get_class_name_from_pci_ids(pci_domain,"pci.ids");
if (return_code == -ENOPCIIDS) {
printf("PCI: ERROR !\n");
printf("PCI: Unable to open pci.ids in the same directory as pcitest.c32.\n");
printf("PCI: Looking for Kernel modules\n");
/* Detecting which kernel module should match each device */
- return_code=get_module_name_from_pci_ids(pci_domain);
+ return_code=get_module_name_from_pci_ids(pci_domain,"modules.pcimap");
if (return_code == -ENOMODULESPCIMAP) {
printf("PCI: ERROR !\n");
printf("PCI: Unable to open modules.pcimap in the same directory as pcitest.c32.\n");