From 2fe1131c7b601d9a5a3f99f0baf9dcb6376999c4 Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Wed, 4 Apr 2012 20:46:20 +0000 Subject: [PATCH] Add a threadid to the ah_decode API. This adds the current thread ID to each logged register and mark entry, allowing for easier debugging of concurrent/overlapping NIC operations. --- sys/dev/ath/ah_osdep.c | 4 ++++ sys/dev/ath/ath_hal/ah_decode.h | 1 + tools/tools/ath/athdecode/main.c | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/dev/ath/ah_osdep.c b/sys/dev/ath/ah_osdep.c index 37b07c13067e..8e9adf735e73 100644 --- a/sys/dev/ath/ah_osdep.c +++ b/sys/dev/ath/ah_osdep.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -257,6 +258,7 @@ ath_hal_reg_write(struct ath_hal *ah, u_int32_t reg, u_int32_t val) struct ale *ale = ath_hal_alq_get(ah); if (ale) { struct athregrec *r = (struct athregrec *) ale->ae_data; + r->threadid = curthread->td_tid; r->op = OP_WRITE; r->reg = reg; r->val = val; @@ -296,6 +298,7 @@ ath_hal_reg_read(struct ath_hal *ah, u_int32_t reg) struct ale *ale = ath_hal_alq_get(ah); if (ale) { struct athregrec *r = (struct athregrec *) ale->ae_data; + r->threadid = curthread->td_tid; r->op = OP_READ; r->reg = reg; r->val = val; @@ -312,6 +315,7 @@ OS_MARK(struct ath_hal *ah, u_int id, u_int32_t v) struct ale *ale = ath_hal_alq_get(ah); if (ale) { struct athregrec *r = (struct athregrec *) ale->ae_data; + r->threadid = curthread->td_tid; r->op = OP_MARK; r->reg = id; r->val = v; diff --git a/sys/dev/ath/ath_hal/ah_decode.h b/sys/dev/ath/ath_hal/ah_decode.h index eb764af9ac87..07c4ac73d41b 100644 --- a/sys/dev/ath/ath_hal/ah_decode.h +++ b/sys/dev/ath/ath_hal/ah_decode.h @@ -29,6 +29,7 @@ * existing file. */ struct athregrec { + uint32_t threadid; uint32_t op : 8, reg : 24; uint32_t val; diff --git a/tools/tools/ath/athdecode/main.c b/tools/tools/ath/athdecode/main.c index 4d0544743d47..1ab5c6d317c0 100644 --- a/tools/tools/ath/athdecode/main.c +++ b/tools/tools/ath/athdecode/main.c @@ -375,7 +375,7 @@ oprw(FILE *fd, int recnum, struct athregrec *r) const char* bits; int i; - fprintf(fd, "\n%05d: ", recnum); + fprintf(fd, "\n%05d: [%d] ", recnum, r->threadid); dr = findreg(r->reg); if (dr != NULL && dr->name != NULL) { snprintf(buf, sizeof (buf), "AR_%s (0x%x)", dr->name, r->reg);