Lines Matching +full:pci +full:- +full:dev

20 static int check_pci_errors;		/* default NO check PCI parity */
21 static int edac_pci_panic_on_pe; /* default NO panic on PCI Parity */
22 static int edac_pci_log_pe = 1; /* log PCI parity errors */
23 static int edac_pci_log_npe = 1; /* log PCI non-parity error errors */
58 /**************************** EDAC PCI sysfs instance *******************/
59 static ssize_t instance_pe_count_show(struct edac_pci_ctl_info *pci, char *data) in instance_pe_count_show() argument
61 return sprintf(data, "%u\n", atomic_read(&pci->counters.pe_count)); in instance_pe_count_show()
64 static ssize_t instance_npe_count_show(struct edac_pci_ctl_info *pci, in instance_npe_count_show() argument
67 return sprintf(data, "%u\n", atomic_read(&pci->counters.npe_count)); in instance_npe_count_show()
76 struct edac_pci_ctl_info *pci; in edac_pci_instance_release() local
80 /* Form pointer to containing struct, the pci control struct */ in edac_pci_instance_release()
81 pci = to_instance(kobj); in edac_pci_instance_release()
86 kfree(pci); /* Free the control struct */ in edac_pci_instance_release()
100 struct edac_pci_ctl_info *pci = to_instance(kobj); in edac_pci_instance_show() local
103 if (instance_attr->show) in edac_pci_instance_show()
104 return instance_attr->show(pci, buffer); in edac_pci_instance_show()
105 return -EIO; in edac_pci_instance_show()
113 struct edac_pci_ctl_info *pci = to_instance(kobj); in edac_pci_instance_store() local
116 if (instance_attr->store) in edac_pci_instance_store()
117 return instance_attr->store(pci, buffer, count); in edac_pci_instance_store()
118 return -EIO; in edac_pci_instance_store()
137 /* pci instance attributes */
145 /* the ktype for a pci instance */
155 * construct one EDAC PCI instance's kobject for use
157 static int edac_pci_create_instance_kobj(struct edac_pci_ctl_info *pci, int idx) in edac_pci_create_instance_kobj() argument
165 * track the number of PCI instances we have, and thus nest in edac_pci_create_instance_kobj()
170 err = -ENODEV; in edac_pci_create_instance_kobj()
175 err = kobject_init_and_add(&pci->kobj, &ktype_pci_instance, in edac_pci_create_instance_kobj()
176 edac_pci_top_main_kobj, "pci%d", idx); in edac_pci_create_instance_kobj()
178 edac_dbg(2, "failed to register instance pci%d\n", idx); in edac_pci_create_instance_kobj()
183 kobject_uevent(&pci->kobj, KOBJ_ADD); in edac_pci_create_instance_kobj()
184 edac_dbg(1, "Register instance 'pci%d' kobject\n", idx); in edac_pci_create_instance_kobj()
196 * unregister the kobj for the EDAC PCI instance
199 struct edac_pci_ctl_info *pci) in edac_pci_unregister_sysfs_instance_kobj() argument
207 kobject_put(&pci->kobj); in edac_pci_unregister_sysfs_instance_kobj()
210 /***************************** EDAC PCI sysfs root **********************/
238 /* Set of show/store abstract level functions for PCI Parity object */
245 if (edac_pci_dev->show) in edac_pci_dev_show()
246 return edac_pci_dev->show(edac_pci_dev->value, buffer); in edac_pci_dev_show()
247 return -EIO; in edac_pci_dev_show()
257 if (edac_pci_dev->store) in edac_pci_dev_store()
258 return edac_pci_dev->store(edac_pci_dev->value, buffer, count); in edac_pci_dev_store()
259 return -EIO; in edac_pci_dev_store()
283 /* PCI Parity control files */
313 * This kobj is the 'main' kobject that EDAC PCI instances
322 /* last reference to top EDAC PCI kobject has been removed, in edac_pci_release_main_kobj()
328 /* ktype struct for the EDAC PCI main kobj */
336 * edac_pci_main_kobj_setup: Setup the sysfs for EDAC PCI attributes.
340 int err = -ENODEV; in edac_pci_main_kobj_setup()
357 * level main kobj for EDAC PCI in edac_pci_main_kobj_setup()
367 err = -ENOMEM; in edac_pci_main_kobj_setup()
371 /* Instanstiate the pci object */ in edac_pci_main_kobj_setup()
376 &dev_root->kobj, "pci"); in edac_pci_main_kobj_setup()
380 edac_dbg(1, "Failed to register '.../edac/pci'\n"); in edac_pci_main_kobj_setup()
385 * for EDAC PCI, then edac_pci_main_kobj_teardown() in edac_pci_main_kobj_setup()
389 edac_dbg(1, "Registered '.../edac/pci' kobject\n"); in edac_pci_main_kobj_setup()
410 * if no longer linked (needed) remove the top level EDAC PCI
427 int edac_pci_create_sysfs(struct edac_pci_ctl_info *pci) in edac_pci_create_sysfs() argument
430 struct kobject *edac_kobj = &pci->kobj; in edac_pci_create_sysfs()
432 edac_dbg(0, "idx=%d\n", pci->pci_idx); in edac_pci_create_sysfs()
434 /* create the top main EDAC PCI kobject, IF needed */ in edac_pci_create_sysfs()
440 err = edac_pci_create_instance_kobj(pci, pci->pci_idx); in edac_pci_create_sysfs()
444 err = sysfs_create_link(edac_kobj, &pci->dev->kobj, EDAC_PCI_SYMLINK); in edac_pci_create_sysfs()
454 edac_pci_unregister_sysfs_instance_kobj(pci); in edac_pci_create_sysfs()
462 void edac_pci_remove_sysfs(struct edac_pci_ctl_info *pci) in edac_pci_remove_sysfs() argument
464 edac_dbg(0, "index=%d\n", pci->pci_idx); in edac_pci_remove_sysfs()
467 sysfs_remove_link(&pci->kobj, EDAC_PCI_SYMLINK); in edac_pci_remove_sysfs()
469 /* remove this PCI instance's sysfs entries */ in edac_pci_remove_sysfs()
470 edac_pci_unregister_sysfs_instance_kobj(pci); in edac_pci_remove_sysfs()
473 * if this 'pci' is the last instance. in edac_pci_remove_sysfs()
480 /************************ PCI error handling *************************/
481 static u16 get_pci_parity_status(struct pci_dev *dev, int secondary) in get_pci_parity_status() argument
487 pci_read_config_word(dev, where, &status); in get_pci_parity_status()
490 * pulled but the Linux PCI layer has not yet finished cleaning up. in get_pci_parity_status()
497 pci_read_config_dword(dev, 0, &sanity); in get_pci_parity_status()
508 pci_write_config_word(dev, where, status); in get_pci_parity_status()
514 /* Clear any PCI parity errors logged by this device. */
515 static void edac_pci_dev_parity_clear(struct pci_dev *dev) in edac_pci_dev_parity_clear() argument
519 get_pci_parity_status(dev, 0); in edac_pci_dev_parity_clear()
522 pci_read_config_byte(dev, PCI_HEADER_TYPE, &header_type); in edac_pci_dev_parity_clear()
525 get_pci_parity_status(dev, 1); in edac_pci_dev_parity_clear()
529 * PCI Parity polling
535 static void edac_pci_dev_parity_test(struct pci_dev *dev) in edac_pci_dev_parity_test() argument
545 status = get_pci_parity_status(dev, 0); in edac_pci_dev_parity_test()
548 pci_read_config_byte(dev, PCI_HEADER_TYPE, &header_type); in edac_pci_dev_parity_test()
552 edac_dbg(4, "PCI STATUS= 0x%04x %s\n", status, dev_name(&dev->dev)); in edac_pci_dev_parity_test()
557 if (status && !dev->broken_parity_status) { in edac_pci_dev_parity_test()
561 pci_name(dev)); in edac_pci_dev_parity_test()
568 pci_name(dev)); in edac_pci_dev_parity_test()
576 pci_name(dev)); in edac_pci_dev_parity_test()
583 edac_dbg(4, "PCI HEADER TYPE= 0x%02x %s\n", in edac_pci_dev_parity_test()
584 header_type, dev_name(&dev->dev)); in edac_pci_dev_parity_test()
588 status = get_pci_parity_status(dev, 1); in edac_pci_dev_parity_test()
590 edac_dbg(4, "PCI SEC_STATUS= 0x%04x %s\n", in edac_pci_dev_parity_test()
591 status, dev_name(&dev->dev)); in edac_pci_dev_parity_test()
596 if (status && !dev->broken_parity_status) { in edac_pci_dev_parity_test()
600 pci_name(dev)); in edac_pci_dev_parity_test()
607 "%s\n", pci_name(dev)); in edac_pci_dev_parity_test()
615 pci_name(dev)); in edac_pci_dev_parity_test()
624 typedef void (*pci_parity_check_fn_t) (struct pci_dev *dev);
629 * Scan the PCI device list looking for SERRORs, Master Parity ERRORS or
634 struct pci_dev *dev = NULL; in edac_pci_dev_parity_iterator() local
636 for_each_pci_dev(dev) in edac_pci_dev_parity_iterator()
637 fn(dev); in edac_pci_dev_parity_iterator()
643 * performs the actual PCI parity check operation
651 /* if policy has PCI check off, leave now */ in edac_pci_do_parity_check()
657 /* scan all PCI devices looking for a Parity Error on devices and in edac_pci_do_parity_check()
664 /* Only if operator has selected panic on PCI Error */ in edac_pci_do_parity_check()
668 panic("EDAC: PCI Parity Error"); in edac_pci_do_parity_check()
675 * function to perform an iteration over the PCI devices
680 /* Clear any PCI bus parity errors that devices initially have logged in edac_pci_clear_parity_errors()
691 void edac_pci_handle_pe(struct edac_pci_ctl_info *pci, const char *msg) in edac_pci_handle_pe() argument
695 atomic_inc(&pci->counters.pe_count); in edac_pci_handle_pe()
698 edac_pci_printk(pci, KERN_WARNING, in edac_pci_handle_pe()
700 pci->ctl_name, pci->pci_idx, msg); in edac_pci_handle_pe()
703 * poke all PCI devices and see which one is the troublemaker in edac_pci_handle_pe()
714 * Called to handle a NON-PARITY ERROR event
716 void edac_pci_handle_npe(struct edac_pci_ctl_info *pci, const char *msg) in edac_pci_handle_npe() argument
720 atomic_inc(&pci->counters.npe_count); in edac_pci_handle_npe()
723 edac_pci_printk(pci, KERN_WARNING, in edac_pci_handle_npe()
724 "Non-Parity Error ctl: %s %d: %s\n", in edac_pci_handle_npe()
725 pci->ctl_name, pci->pci_idx, msg); in edac_pci_handle_npe()
728 * poke all PCI devices and see which one is the troublemaker in edac_pci_handle_npe()
736 * Define the PCI parameter to the module
740 "Check for PCI bus parity errors: 0=off 1=on");
743 "Panic on PCI Bus Parity error: 0=off 1=on");