Module Name:    src
Committed By:   macallan
Date:           Fri Aug  5 20:21:58 UTC 2016

Modified Files:
        src/sys/arch/sgimips/mace: pci_mace.c

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/sgimips/mace/pci_mace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sgimips/mace/pci_mace.c
diff -u src/sys/arch/sgimips/mace/pci_mace.c:1.20 src/sys/arch/sgimips/mace/pci_mace.c:1.21
--- src/sys/arch/sgimips/mace/pci_mace.c:1.20	Fri Oct  2 05:22:52 2015
+++ src/sys/arch/sgimips/mace/pci_mace.c	Fri Aug  5 20:21:58 2016
@@ -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 @@ macepci_intr(void *arg)
 {
 	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 @@ macepci_intr(void *arg)
 			 * 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;
 }

Reply via email to