Created
August 6, 2022 16:07
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/obio/esp.c b/obio/esp.c | |
index 6580436..fc71876 100644 | |
--- a/obio/esp.c | |
+++ b/obio/esp.c | |
@@ -103,6 +103,18 @@ __KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.60 2021/02/22 05:23:36 rin Exp $"); | |
#include <mac68k/obio/espvar.h> | |
#include <mac68k/obio/obiovar.h> | |
+#ifdef ESP_DREQ_DEBUG | |
+#include <sys/evcnt.h> | |
+#define ESP_EVCNT_ATTACH(name) \ | |
+ static struct evcnt esp_ev_##name = \ | |
+ EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "esp", #name); \ | |
+ EVCNT_ATTACH_STATIC(esp_ev_##name) | |
+#define ESP_EVCNT_INCR(name) esp_ev_##name.ev_count++ | |
+ESP_EVCNT_ATTACH(dreq0); | |
+ESP_EVCNT_ATTACH(dreq1); | |
+ESP_EVCNT_ATTACH(spurious); | |
+#endif | |
+ | |
static int espmatch(device_t, cfdata_t, void *); | |
static void espattach(device_t, device_t, void *); | |
@@ -693,8 +705,18 @@ esp_dafb_have_dreq(struct esp_softc *esc) | |
static int | |
esp_iosb_have_dreq(struct esp_softc *esc) | |
{ | |
+#ifdef ESP_DREQ_DEBUG | |
+ int val = via2_reg(vIFR) & V2IF_SCSIDRQ; | |
+ | |
+ if (val) | |
+ ESP_EVCNT_INCR(dreq1); | |
+ else | |
+ ESP_EVCNT_INCR(dreq0); | |
+ return val; | |
+#else | |
return via2_reg(vIFR) & V2IF_SCSIDRQ; | |
+#endif | |
} | |
static volatile int espspl = -1; | |
@@ -978,6 +1000,11 @@ esp_intr(void *sc) | |
if (esc->sc_reg[NCR_STAT * 16] & 0x80) { | |
ncr53c9x_intr((struct ncr53c9x_softc *)esp0); | |
} | |
+#ifdef ESP_DREQ_DEBUG | |
+ else { | |
+ ESP_EVCNT_INCR(spurious); | |
+ } | |
+#endif | |
} | |
static void |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment