altera_edac.c (c95baf12f5077419db01313ab61c2aac007d40cd) altera_edac.c (098da961d8b8c279d34a8f7cd26ff0317f718df6)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2017-2018, Intel Corporation. All rights reserved
4 * Copyright Altera Corporation (C) 2014-2016. All rights reserved.
5 * Copyright 2011-2012 Calxeda, Inc.
6 */
7
8#include <asm/cacheflush.h>

--- 1487 unchanged lines hidden (view full) ---

1496 altdev->edac_idx = edac_idx;
1497 altdev->edac_dev = dci;
1498 altdev->data = prv;
1499 dci->dev = &altdev->ddev;
1500 dci->ctl_name = "Altera ECC Manager";
1501 dci->mod_name = ecc_name;
1502 dci->dev_name = ecc_name;
1503
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2017-2018, Intel Corporation. All rights reserved
4 * Copyright Altera Corporation (C) 2014-2016. All rights reserved.
5 * Copyright 2011-2012 Calxeda, Inc.
6 */
7
8#include <asm/cacheflush.h>

--- 1487 unchanged lines hidden (view full) ---

1496 altdev->edac_idx = edac_idx;
1497 altdev->edac_dev = dci;
1498 altdev->data = prv;
1499 dci->dev = &altdev->ddev;
1500 dci->ctl_name = "Altera ECC Manager";
1501 dci->mod_name = ecc_name;
1502 dci->dev_name = ecc_name;
1503
1504 /* Update the PortB IRQs - A10 has 4, S10 has 2, Index accordingly */
1505#ifdef CONFIG_ARCH_STRATIX10
1504 /*
1505 * Update the PortB IRQs - A10 has 4, S10 has 2, Index accordingly
1506 *
1507 * FIXME: Instead of ifdefs with different architectures the driver
1508 * should properly use compatibles.
1509 */
1510#ifdef CONFIG_64BIT
1506 altdev->sb_irq = irq_of_parse_and_map(np, 1);
1507#else
1508 altdev->sb_irq = irq_of_parse_and_map(np, 2);
1509#endif
1510 if (!altdev->sb_irq) {
1511 edac_printk(KERN_ERR, EDAC_DEVICE, "Error PortB SBIRQ alloc\n");
1512 rc = -ENODEV;
1513 goto err_release_group_1;
1514 }
1515 rc = devm_request_irq(&altdev->ddev, altdev->sb_irq,
1516 prv->ecc_irq_handler,
1517 IRQF_ONESHOT | IRQF_TRIGGER_HIGH,
1518 ecc_name, altdev);
1519 if (rc) {
1520 edac_printk(KERN_ERR, EDAC_DEVICE, "PortB SBERR IRQ error\n");
1521 goto err_release_group_1;
1522 }
1523
1511 altdev->sb_irq = irq_of_parse_and_map(np, 1);
1512#else
1513 altdev->sb_irq = irq_of_parse_and_map(np, 2);
1514#endif
1515 if (!altdev->sb_irq) {
1516 edac_printk(KERN_ERR, EDAC_DEVICE, "Error PortB SBIRQ alloc\n");
1517 rc = -ENODEV;
1518 goto err_release_group_1;
1519 }
1520 rc = devm_request_irq(&altdev->ddev, altdev->sb_irq,
1521 prv->ecc_irq_handler,
1522 IRQF_ONESHOT | IRQF_TRIGGER_HIGH,
1523 ecc_name, altdev);
1524 if (rc) {
1525 edac_printk(KERN_ERR, EDAC_DEVICE, "PortB SBERR IRQ error\n");
1526 goto err_release_group_1;
1527 }
1528
1524#ifdef CONFIG_ARCH_STRATIX10
1529#ifdef CONFIG_64BIT
1525 /* Use IRQ to determine SError origin instead of assigning IRQ */
1526 rc = of_property_read_u32_index(np, "interrupts", 1, &altdev->db_irq);
1527 if (rc) {
1528 edac_printk(KERN_ERR, EDAC_DEVICE,
1529 "Error PortB DBIRQ alloc\n");
1530 goto err_release_group_1;
1531 }
1532#else

--- 393 unchanged lines hidden (view full) ---

1926 rc = devm_request_irq(edac->dev, altdev->sb_irq, prv->ecc_irq_handler,
1927 IRQF_ONESHOT | IRQF_TRIGGER_HIGH,
1928 ecc_name, altdev);
1929 if (rc) {
1930 edac_printk(KERN_ERR, EDAC_DEVICE, "No SBERR IRQ resource\n");
1931 goto err_release_group1;
1932 }
1933
1530 /* Use IRQ to determine SError origin instead of assigning IRQ */
1531 rc = of_property_read_u32_index(np, "interrupts", 1, &altdev->db_irq);
1532 if (rc) {
1533 edac_printk(KERN_ERR, EDAC_DEVICE,
1534 "Error PortB DBIRQ alloc\n");
1535 goto err_release_group_1;
1536 }
1537#else

--- 393 unchanged lines hidden (view full) ---

1931 rc = devm_request_irq(edac->dev, altdev->sb_irq, prv->ecc_irq_handler,
1932 IRQF_ONESHOT | IRQF_TRIGGER_HIGH,
1933 ecc_name, altdev);
1934 if (rc) {
1935 edac_printk(KERN_ERR, EDAC_DEVICE, "No SBERR IRQ resource\n");
1936 goto err_release_group1;
1937 }
1938
1934#ifdef CONFIG_ARCH_STRATIX10
1939#ifdef CONFIG_64BIT
1935 /* Use IRQ to determine SError origin instead of assigning IRQ */
1936 rc = of_property_read_u32_index(np, "interrupts", 0, &altdev->db_irq);
1937 if (rc) {
1938 edac_printk(KERN_ERR, EDAC_DEVICE,
1939 "Unable to parse DB IRQ index\n");
1940 goto err_release_group1;
1941 }
1942#else

--- 68 unchanged lines hidden (view full) ---

2011static const struct irq_domain_ops a10_eccmgr_ic_ops = {
2012 .map = a10_eccmgr_irqdomain_map,
2013 .xlate = irq_domain_xlate_twocell,
2014};
2015
2016/************** Stratix 10 EDAC Double Bit Error Handler ************/
2017#define to_a10edac(p, m) container_of(p, struct altr_arria10_edac, m)
2018
1940 /* Use IRQ to determine SError origin instead of assigning IRQ */
1941 rc = of_property_read_u32_index(np, "interrupts", 0, &altdev->db_irq);
1942 if (rc) {
1943 edac_printk(KERN_ERR, EDAC_DEVICE,
1944 "Unable to parse DB IRQ index\n");
1945 goto err_release_group1;
1946 }
1947#else

--- 68 unchanged lines hidden (view full) ---

2016static const struct irq_domain_ops a10_eccmgr_ic_ops = {
2017 .map = a10_eccmgr_irqdomain_map,
2018 .xlate = irq_domain_xlate_twocell,
2019};
2020
2021/************** Stratix 10 EDAC Double Bit Error Handler ************/
2022#define to_a10edac(p, m) container_of(p, struct altr_arria10_edac, m)
2023
2019#ifdef CONFIG_ARCH_STRATIX10
2024#ifdef CONFIG_64BIT
2020/* panic routine issues reboot on non-zero panic_timeout */
2021extern int panic_timeout;
2022
2023/*
2024 * The double bit error is handled through SError which is fatal. This is
2025 * called as a panic notifier to printout ECC error info as part of the panic.
2026 */
2027static int s10_edac_dberr_handler(struct notifier_block *this,

--- 76 unchanged lines hidden (view full) ---

2104 dev_err(&pdev->dev, "No SBERR IRQ resource\n");
2105 return edac->sb_irq;
2106 }
2107
2108 irq_set_chained_handler_and_data(edac->sb_irq,
2109 altr_edac_a10_irq_handler,
2110 edac);
2111
2025/* panic routine issues reboot on non-zero panic_timeout */
2026extern int panic_timeout;
2027
2028/*
2029 * The double bit error is handled through SError which is fatal. This is
2030 * called as a panic notifier to printout ECC error info as part of the panic.
2031 */
2032static int s10_edac_dberr_handler(struct notifier_block *this,

--- 76 unchanged lines hidden (view full) ---

2109 dev_err(&pdev->dev, "No SBERR IRQ resource\n");
2110 return edac->sb_irq;
2111 }
2112
2113 irq_set_chained_handler_and_data(edac->sb_irq,
2114 altr_edac_a10_irq_handler,
2115 edac);
2116
2112#ifdef CONFIG_ARCH_STRATIX10
2117#ifdef CONFIG_64BIT
2113 {
2114 int dberror, err_addr;
2115
2116 edac->panic_notifier.notifier_call = s10_edac_dberr_handler;
2117 atomic_notifier_chain_register(&panic_notifier_list,
2118 &edac->panic_notifier);
2119
2120 /* Printout a message if uncorrectable error previously. */

--- 62 unchanged lines hidden ---
2118 {
2119 int dberror, err_addr;
2120
2121 edac->panic_notifier.notifier_call = s10_edac_dberr_handler;
2122 atomic_notifier_chain_register(&panic_notifier_list,
2123 &edac->panic_notifier);
2124
2125 /* Printout a message if uncorrectable error previously. */

--- 62 unchanged lines hidden ---