Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sgimips/mace simplify macepci_intr():



details:   https://anonhg.NetBSD.org/src/rev/e0ed50e02aa4
branches:  trunk
changeset: 346892:e0ed50e02aa4
user:      macallan <macallan%NetBSD.org@localhost>
date:      Fri Aug 05 20:21:58 2016 +0000

description:
simplify macepci_intr():
- use uint32_t
- always clear all error bits
- avoid a compiler bug(?) which caused the test for MACE_PERR_MASTER_ABORT
  to fail on n32
now my O2 no longer hangs when leaving cold

diffstat:

 sys/arch/sgimips/mace/pci_mace.c |  42 +++++++--------------------------------
 1 files changed, 8 insertions(+), 34 deletions(-)

diffs (110 lines):

diff -r eaeca0ffc706 -r e0ed50e02aa4 sys/arch/sgimips/mace/pci_mace.c
--- a/sys/arch/sgimips/mace/pci_mace.c  Fri Aug 05 20:15:41 2016 +0000
+++ b/sys/arch/sgimips/mace/pci_mace.c  Fri Aug 05 20:21:58 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_mace.c,v 1.20 2015/10/02 05:22:52 msaitoh Exp $    */
+/*     $NetBSD: pci_mace.c,v 1.21 2016/08/05 20:21:58 macallan Exp $   */
 
 /*
  * Copyright (c) 2001,2003 Christopher Sekiya
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_mace.c,v 1.20 2015/10/02 05:22:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_mace.c,v 1.21 2016/08/05 20:21:58 macallan Exp $");
 
 #include "opt_pci.h"
 #include "pci.h"
@@ -293,11 +293,11 @@
 {
        struct macepci_softc *sc = (struct macepci_softc *)arg;
        pci_chipset_tag_t pc = &sc->sc_pc;
-       u_int32_t error, address;
+       uint32_t error, address;
 
        error = bus_space_read_4(pc->iot, pc->ioh, MACE_PCI_ERROR_FLAGS);
        address = bus_space_read_4(pc->iot, pc->ioh, MACE_PCI_ERROR_ADDR);
-       while (error & 0xffc00000) {
+       if (error & 0xffc00000) {
                if (error & MACE_PERR_MASTER_ABORT) {
                        /*
                         * this seems to be a more-or-less normal error
@@ -305,73 +305,47 @@
                         * a _lot_ of these errors, so no message for now
                         * while I figure out if I missed a trick somewhere.
                         */
-                       error &= ~MACE_PERR_MASTER_ABORT;
-                       bus_space_write_4(pc->iot, pc->ioh,
-                           MACE_PCI_ERROR_FLAGS, error);
                }
 
                if (error & MACE_PERR_TARGET_ABORT) {
                        printf("mace: target abort at %x\n", address);
-                       error &= ~MACE_PERR_TARGET_ABORT;
-                       bus_space_write_4(pc->iot, pc->ioh,
-                           MACE_PCI_ERROR_FLAGS, error);
                }
 
                if (error & MACE_PERR_DATA_PARITY_ERR) {
                        printf("mace: parity error at %x\n", address);
-                       error &= ~MACE_PERR_DATA_PARITY_ERR;
-                       bus_space_write_4(pc->iot, pc->ioh,
-                           MACE_PCI_ERROR_FLAGS, error);
                }
 
                if (error & MACE_PERR_RETRY_ERR) {
                        printf("mace: retry error at %x\n", address);
-                       error &= ~MACE_PERR_RETRY_ERR;
-                       bus_space_write_4(pc->iot, pc->ioh,
-                           MACE_PCI_ERROR_FLAGS, error);
                }
 
                if (error & MACE_PERR_ILLEGAL_CMD) {
                        printf("mace: illegal command at %x\n", address);
-                       error &= ~MACE_PERR_ILLEGAL_CMD;
-                       bus_space_write_4(pc->iot, pc->ioh,
-                           MACE_PCI_ERROR_FLAGS, error);
                }
 
                if (error & MACE_PERR_SYSTEM_ERR) {
                        printf("mace: system error at %x\n", address);
-                       error &= ~MACE_PERR_SYSTEM_ERR;
-                       bus_space_write_4(pc->iot, pc->ioh,
-                           MACE_PCI_ERROR_FLAGS, error);
                }
 
                if (error & MACE_PERR_INTERRUPT_TEST) {
                        printf("mace: interrupt test at %x\n", address);
-                       error &= ~MACE_PERR_INTERRUPT_TEST;
-                       bus_space_write_4(pc->iot, pc->ioh,
-                           MACE_PCI_ERROR_FLAGS, error);
                }
 
                if (error & MACE_PERR_PARITY_ERR) {
                        printf("mace: parity error at %x\n", address);
-                       error &= ~MACE_PERR_PARITY_ERR;
-                       bus_space_write_4(pc->iot, pc->ioh,
-                           MACE_PCI_ERROR_FLAGS, error);
                }
 
                if (error & MACE_PERR_RSVD) {
                        printf("mace: reserved condition at %x\n", address);
-                       error &= ~MACE_PERR_RSVD;
-                       bus_space_write_4(pc->iot, pc->ioh,
-                           MACE_PCI_ERROR_FLAGS, error);
                }
 
                if (error & MACE_PERR_OVERRUN) {
                        printf("mace: overrun at %x\n", address);
-                       error &= ~MACE_PERR_OVERRUN;
-                       bus_space_write_4(pc->iot, pc->ioh,
-                           MACE_PCI_ERROR_FLAGS, error);
                }
+
+               /* clear all */
+               bus_space_write_4(pc->iot, pc->ioh,
+                           MACE_PCI_ERROR_FLAGS, error & ~0xffc00000);
        }
        return 0;
 }



Home | Main Index | Thread Index | Old Index