aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64
diff options
context:
space:
mode:
authorLinas Vepstas <linas@linas.org>2005-11-03 19:47:50 -0500
committerPaul Mackerras <paulus@samba.org>2005-11-09 19:30:29 -0500
commit693765021460f19c5d7c638eb76e2efe1cd84752 (patch)
treebc311a26c4bea53a1d0c263e8533208efc1d5a93 /arch/ppc64
parentae65a391caf1830aea9e4cadd69bb1aa69aad492 (diff)
[PATCH] ppc64: misc minor cleanup
02-eeh-minor-cleanup.patch This patch performs some minor cleanup of the eeh.c file, including: -- trim some trailing whitespace -- remove extraneous #includes -- use the macro PCI_DN uniformly, instead of the void pointer chase. -- typos in comments -- improved debug printk's Signed-off-by: Linas Vepstas <linas@linas.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/ppc64')
-rw-r--r--arch/ppc64/kernel/eeh.c53
1 files changed, 25 insertions, 28 deletions
diff --git a/arch/ppc64/kernel/eeh.c b/arch/ppc64/kernel/eeh.c
index eedf21d5f3b7..bb11569d2b4b 100644
--- a/arch/ppc64/kernel/eeh.c
+++ b/arch/ppc64/kernel/eeh.c
@@ -1,32 +1,31 @@
1/* 1/*
2 * eeh.c 2 * eeh.c
3 * Copyright (C) 2001 Dave Engebretsen & Todd Inglett IBM Corporation 3 * Copyright (C) 2001 Dave Engebretsen & Todd Inglett IBM Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or 7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19 19
20#include <linux/bootmem.h>
21#include <linux/init.h> 20#include <linux/init.h>
22#include <linux/list.h> 21#include <linux/list.h>
23#include <linux/mm.h>
24#include <linux/notifier.h> 22#include <linux/notifier.h>
25#include <linux/pci.h> 23#include <linux/pci.h>
26#include <linux/proc_fs.h> 24#include <linux/proc_fs.h>
27#include <linux/rbtree.h> 25#include <linux/rbtree.h>
28#include <linux/seq_file.h> 26#include <linux/seq_file.h>
29#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28#include <asm/atomic.h>
30#include <asm/eeh.h> 29#include <asm/eeh.h>
31#include <asm/io.h> 30#include <asm/io.h>
32#include <asm/machdep.h> 31#include <asm/machdep.h>
@@ -49,8 +48,8 @@
49 * were "empty": all reads return 0xff's and all writes are silently 48 * were "empty": all reads return 0xff's and all writes are silently
50 * ignored. EEH slot isolation events can be triggered by parity 49 * ignored. EEH slot isolation events can be triggered by parity
51 * errors on the address or data busses (e.g. during posted writes), 50 * errors on the address or data busses (e.g. during posted writes),
52 * which in turn might be caused by dust, vibration, humidity, 51 * which in turn might be caused by low voltage on the bus, dust,
53 * radioactivity or plain-old failed hardware. 52 * vibration, humidity, radioactivity or plain-old failed hardware.
54 * 53 *
55 * Note, however, that one of the leading causes of EEH slot 54 * Note, however, that one of the leading causes of EEH slot
56 * freeze events are buggy device drivers, buggy device microcode, 55 * freeze events are buggy device drivers, buggy device microcode,
@@ -256,18 +255,17 @@ static void __pci_addr_cache_insert_device(struct pci_dev *dev)
256 255
257 dn = pci_device_to_OF_node(dev); 256 dn = pci_device_to_OF_node(dev);
258 if (!dn) { 257 if (!dn) {
259 printk(KERN_WARNING "PCI: no pci dn found for dev=%s\n", 258 printk(KERN_WARNING "PCI: no pci dn found for dev=%s\n", pci_name(dev));
260 pci_name(dev));
261 return; 259 return;
262 } 260 }
263 261
264 /* Skip any devices for which EEH is not enabled. */ 262 /* Skip any devices for which EEH is not enabled. */
265 pdn = dn->data; 263 pdn = PCI_DN(dn);
266 if (!(pdn->eeh_mode & EEH_MODE_SUPPORTED) || 264 if (!(pdn->eeh_mode & EEH_MODE_SUPPORTED) ||
267 pdn->eeh_mode & EEH_MODE_NOCHECK) { 265 pdn->eeh_mode & EEH_MODE_NOCHECK) {
268#ifdef DEBUG 266#ifdef DEBUG
269 printk(KERN_INFO "PCI: skip building address cache for=%s\n", 267 printk(KERN_INFO "PCI: skip building address cache for=%s - %s\n",
270 pci_name(dev)); 268 pci_name(dev), pdn->node->full_name);
271#endif 269#endif
272 return; 270 return;
273 } 271 }
@@ -410,16 +408,16 @@ int eeh_unregister_notifier(struct notifier_block *nb)
410 * @dn: device node to read 408 * @dn: device node to read
411 * @rets: array to return results in 409 * @rets: array to return results in
412 */ 410 */
413static int read_slot_reset_state(struct device_node *dn, int rets[]) 411static int read_slot_reset_state(struct pci_dn *pdn, int rets[])
414{ 412{
415 int token, outputs; 413 int token, outputs;
416 struct pci_dn *pdn = dn->data;
417 414
418 if (ibm_read_slot_reset_state2 != RTAS_UNKNOWN_SERVICE) { 415 if (ibm_read_slot_reset_state2 != RTAS_UNKNOWN_SERVICE) {
419 token = ibm_read_slot_reset_state2; 416 token = ibm_read_slot_reset_state2;
420 outputs = 4; 417 outputs = 4;
421 } else { 418 } else {
422 token = ibm_read_slot_reset_state; 419 token = ibm_read_slot_reset_state;
420 rets[2] = 0; /* fake PE Unavailable info */
423 outputs = 3; 421 outputs = 3;
424 } 422 }
425 423
@@ -496,7 +494,7 @@ static void eeh_event_handler(void *dummy)
496 494
497/** 495/**
498 * eeh_token_to_phys - convert EEH address token to phys address 496 * eeh_token_to_phys - convert EEH address token to phys address
499 * @token i/o token, should be address in the form 0xE.... 497 * @token i/o token, should be address in the form 0xA....
500 */ 498 */
501static inline unsigned long eeh_token_to_phys(unsigned long token) 499static inline unsigned long eeh_token_to_phys(unsigned long token)
502{ 500{
@@ -522,7 +520,7 @@ static inline unsigned long eeh_token_to_phys(unsigned long token)
522 * will query firmware for the EEH status. 520 * will query firmware for the EEH status.
523 * 521 *
524 * Returns 0 if there has not been an EEH error; otherwise returns 522 * Returns 0 if there has not been an EEH error; otherwise returns
525 * a non-zero value and queues up a solt isolation event notification. 523 * a non-zero value and queues up a slot isolation event notification.
526 * 524 *
527 * It is safe to call this routine in an interrupt context. 525 * It is safe to call this routine in an interrupt context.
528 */ 526 */
@@ -542,7 +540,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
542 540
543 if (!dn) 541 if (!dn)
544 return 0; 542 return 0;
545 pdn = dn->data; 543 pdn = PCI_DN(dn);
546 544
547 /* Access to IO BARs might get this far and still not want checking. */ 545 /* Access to IO BARs might get this far and still not want checking. */
548 if (!pdn->eeh_capable || !(pdn->eeh_mode & EEH_MODE_SUPPORTED) || 546 if (!pdn->eeh_capable || !(pdn->eeh_mode & EEH_MODE_SUPPORTED) ||
@@ -562,7 +560,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
562 atomic_inc(&eeh_fail_count); 560 atomic_inc(&eeh_fail_count);
563 if (atomic_read(&eeh_fail_count) >= EEH_MAX_FAILS) { 561 if (atomic_read(&eeh_fail_count) >= EEH_MAX_FAILS) {
564 /* re-read the slot reset state */ 562 /* re-read the slot reset state */
565 if (read_slot_reset_state(dn, rets) != 0) 563 if (read_slot_reset_state(pdn, rets) != 0)
566 rets[0] = -1; /* reset state unknown */ 564 rets[0] = -1; /* reset state unknown */
567 eeh_panic(dev, rets[0]); 565 eeh_panic(dev, rets[0]);
568 } 566 }
@@ -576,7 +574,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
576 * function zero of a multi-function device. 574 * function zero of a multi-function device.
577 * In any case they must share a common PHB. 575 * In any case they must share a common PHB.
578 */ 576 */
579 ret = read_slot_reset_state(dn, rets); 577 ret = read_slot_reset_state(pdn, rets);
580 if (!(ret == 0 && rets[1] == 1 && (rets[0] == 2 || rets[0] == 4))) { 578 if (!(ret == 0 && rets[1] == 1 && (rets[0] == 2 || rets[0] == 4))) {
581 __get_cpu_var(false_positives)++; 579 __get_cpu_var(false_positives)++;
582 return 0; 580 return 0;
@@ -635,7 +633,6 @@ EXPORT_SYMBOL(eeh_dn_check_failure);
635 * @token i/o token, should be address in the form 0xA.... 633 * @token i/o token, should be address in the form 0xA....
636 * @val value, should be all 1's (XXX why do we need this arg??) 634 * @val value, should be all 1's (XXX why do we need this arg??)
637 * 635 *
638 * Check for an eeh failure at the given token address.
639 * Check for an EEH failure at the given token address. Call this 636 * Check for an EEH failure at the given token address. Call this
640 * routine if the result of a read was all 0xff's and you want to 637 * routine if the result of a read was all 0xff's and you want to
641 * find out if this is due to an EEH slot freeze event. This routine 638 * find out if this is due to an EEH slot freeze event. This routine
@@ -680,7 +677,7 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
680 u32 *device_id = (u32 *)get_property(dn, "device-id", NULL); 677 u32 *device_id = (u32 *)get_property(dn, "device-id", NULL);
681 u32 *regs; 678 u32 *regs;
682 int enable; 679 int enable;
683 struct pci_dn *pdn = dn->data; 680 struct pci_dn *pdn = PCI_DN(dn);
684 681
685 pdn->eeh_mode = 0; 682 pdn->eeh_mode = 0;
686 683
@@ -732,7 +729,7 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
732 729
733 /* This device doesn't support EEH, but it may have an 730 /* This device doesn't support EEH, but it may have an
734 * EEH parent, in which case we mark it as supported. */ 731 * EEH parent, in which case we mark it as supported. */
735 if (dn->parent && dn->parent->data 732 if (dn->parent && PCI_DN(dn->parent)
736 && (PCI_DN(dn->parent)->eeh_mode & EEH_MODE_SUPPORTED)) { 733 && (PCI_DN(dn->parent)->eeh_mode & EEH_MODE_SUPPORTED)) {
737 /* Parent supports EEH. */ 734 /* Parent supports EEH. */
738 pdn->eeh_mode |= EEH_MODE_SUPPORTED; 735 pdn->eeh_mode |= EEH_MODE_SUPPORTED;
@@ -745,7 +742,7 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
745 dn->full_name); 742 dn->full_name);
746 } 743 }
747 744
748 return NULL; 745 return NULL;
749} 746}
750 747
751/* 748/*
@@ -793,13 +790,11 @@ void __init eeh_init(void)
793 for (phb = of_find_node_by_name(NULL, "pci"); phb; 790 for (phb = of_find_node_by_name(NULL, "pci"); phb;
794 phb = of_find_node_by_name(phb, "pci")) { 791 phb = of_find_node_by_name(phb, "pci")) {
795 unsigned long buid; 792 unsigned long buid;
796 struct pci_dn *pci;
797 793
798 buid = get_phb_buid(phb); 794 buid = get_phb_buid(phb);
799 if (buid == 0 || phb->data == NULL) 795 if (buid == 0 || PCI_DN(phb) == NULL)
800 continue; 796 continue;
801 797
802 pci = phb->data;
803 info.buid_lo = BUID_LO(buid); 798 info.buid_lo = BUID_LO(buid);
804 info.buid_hi = BUID_HI(buid); 799 info.buid_hi = BUID_HI(buid);
805 traverse_pci_devices(phb, early_enable_eeh, &info); 800 traverse_pci_devices(phb, early_enable_eeh, &info);
@@ -828,11 +823,13 @@ void eeh_add_device_early(struct device_node *dn)
828 struct pci_controller *phb; 823 struct pci_controller *phb;
829 struct eeh_early_enable_info info; 824 struct eeh_early_enable_info info;
830 825
831 if (!dn || !dn->data) 826 if (!dn || !PCI_DN(dn))
832 return; 827 return;
833 phb = PCI_DN(dn)->phb; 828 phb = PCI_DN(dn)->phb;
834 if (NULL == phb || 0 == phb->buid) { 829 if (NULL == phb || 0 == phb->buid) {
835 printk(KERN_WARNING "EEH: Expected buid but found none\n"); 830 printk(KERN_WARNING "EEH: Expected buid but found none for %s\n",
831 dn->full_name);
832 dump_stack();
836 return; 833 return;
837 } 834 }
838 835