aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sky2.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@osdl.org>2006-09-26 14:57:38 -0400
committerJeff Garzik <jeff@garzik.org>2006-09-27 17:56:31 -0400
commit91aeb3edbcf4e6ed72d138ac8c22fd68e6d717c3 (patch)
tree47e6dc5ace173532b438f35a1e899545178abcc9 /drivers/net/sky2.c
parente0ed5459030a8c9ddde44ef49bcb63aa6db425e1 (diff)
[PATCH] sky2: use standard pci register capabilties for error register
Use the standard pci capability mechanism to access PCI express error registers, rather than hard coding the offset. Mask off the PCI express error from ever occuring on non-PCI express systems. Signed-off-by: Stephen Hemminger <shemminger@osdl.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/sky2.c')
-rw-r--r--drivers/net/sky2.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 3ff2f426fd63..d3174ed8e454 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -2093,7 +2093,7 @@ static void sky2_hw_intr(struct sky2_hw *hw)
2093 2093
2094 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); 2094 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
2095 sky2_pci_write16(hw, PCI_STATUS, 2095 sky2_pci_write16(hw, PCI_STATUS,
2096 pci_err | PCI_STATUS_ERROR_BITS); 2096 pci_err | PCI_STATUS_ERROR_BITS);
2097 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); 2097 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
2098 } 2098 }
2099 2099
@@ -2101,7 +2101,8 @@ static void sky2_hw_intr(struct sky2_hw *hw)
2101 /* PCI-Express uncorrectable Error occurred */ 2101 /* PCI-Express uncorrectable Error occurred */
2102 u32 pex_err; 2102 u32 pex_err;
2103 2103
2104 pex_err = sky2_pci_read32(hw, PEX_UNC_ERR_STAT); 2104 pex_err = sky2_pci_read32(hw,
2105 hw->err_cap + PCI_ERR_UNCOR_STATUS);
2105 2106
2106 if (net_ratelimit()) 2107 if (net_ratelimit())
2107 printk(KERN_ERR PFX "%s: pci express error (0x%x)\n", 2108 printk(KERN_ERR PFX "%s: pci express error (0x%x)\n",
@@ -2109,15 +2110,20 @@ static void sky2_hw_intr(struct sky2_hw *hw)
2109 2110
2110 /* clear the interrupt */ 2111 /* clear the interrupt */
2111 sky2_write32(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); 2112 sky2_write32(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
2112 sky2_pci_write32(hw, PEX_UNC_ERR_STAT, 2113 sky2_pci_write32(hw,
2113 0xffffffffUL); 2114 hw->err_cap + PCI_ERR_UNCOR_STATUS,
2115 0xffffffffUL);
2114 sky2_write32(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); 2116 sky2_write32(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
2115 2117
2116 if (pex_err & PEX_FATAL_ERRORS) { 2118
2119 /* In case of fatal error mask off to keep from getting stuck */
2120 if (pex_err & (PCI_ERR_UNC_POISON_TLP | PCI_ERR_UNC_FCP
2121 | PCI_ERR_UNC_DLP)) {
2117 u32 hwmsk = sky2_read32(hw, B0_HWE_IMSK); 2122 u32 hwmsk = sky2_read32(hw, B0_HWE_IMSK);
2118 hwmsk &= ~Y2_IS_PCI_EXP; 2123 hwmsk &= ~Y2_IS_PCI_EXP;
2119 sky2_write32(hw, B0_HWE_IMSK, hwmsk); 2124 sky2_write32(hw, B0_HWE_IMSK, hwmsk);
2120 } 2125 }
2126
2121 } 2127 }
2122 2128
2123 if (status & Y2_HWE_L1_MASK) 2129 if (status & Y2_HWE_L1_MASK)
@@ -2298,6 +2304,7 @@ static int sky2_reset(struct sky2_hw *hw)
2298 u16 status; 2304 u16 status;
2299 u8 t8; 2305 u8 t8;
2300 int i; 2306 int i;
2307 u32 msk;
2301 2308
2302 sky2_write8(hw, B0_CTST, CS_RST_CLR); 2309 sky2_write8(hw, B0_CTST, CS_RST_CLR);
2303 2310
@@ -2338,9 +2345,13 @@ static int sky2_reset(struct sky2_hw *hw)
2338 sky2_write8(hw, B0_CTST, CS_MRST_CLR); 2345 sky2_write8(hw, B0_CTST, CS_MRST_CLR);
2339 2346
2340 /* clear any PEX errors */ 2347 /* clear any PEX errors */
2341 if (pci_find_capability(hw->pdev, PCI_CAP_ID_EXP)) 2348 if (pci_find_capability(hw->pdev, PCI_CAP_ID_EXP)) {
2342 sky2_pci_write32(hw, PEX_UNC_ERR_STAT, 0xffffffffUL); 2349 hw->err_cap = pci_find_ext_capability(hw->pdev, PCI_EXT_CAP_ID_ERR);
2343 2350 if (hw->err_cap)
2351 sky2_pci_write32(hw,
2352 hw->err_cap + PCI_ERR_UNCOR_STATUS,
2353 0xffffffffUL);
2354 }
2344 2355
2345 hw->pmd_type = sky2_read8(hw, B2_PMD_TYP); 2356 hw->pmd_type = sky2_read8(hw, B2_PMD_TYP);
2346 hw->ports = 1; 2357 hw->ports = 1;
@@ -2397,7 +2408,10 @@ static int sky2_reset(struct sky2_hw *hw)
2397 sky2_write8(hw, RAM_BUFFER(i, B3_RI_RTO_XS2), SK_RI_TO_53); 2408 sky2_write8(hw, RAM_BUFFER(i, B3_RI_RTO_XS2), SK_RI_TO_53);
2398 } 2409 }
2399 2410
2400 sky2_write32(hw, B0_HWE_IMSK, Y2_HWE_ALL_MASK); 2411 msk = Y2_HWE_ALL_MASK;
2412 if (!hw->err_cap)
2413 msk &= ~Y2_IS_PCI_EXP;
2414 sky2_write32(hw, B0_HWE_IMSK, msk);
2401 2415
2402 for (i = 0; i < hw->ports; i++) 2416 for (i = 0; i < hw->ports; i++)
2403 sky2_gmac_reset(hw, i); 2417 sky2_gmac_reset(hw, i);