summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfgsch <fgsch@openbsd.org>2008-06-30 00:13:30 +0000
committerfgsch <fgsch@openbsd.org>2008-06-30 00:13:30 +0000
commit51d83534623bf02037770358e071569d0e7c38e1 (patch)
tree0a6f01790254df0506f06eb7a809a6b0793dc0f4
parentre* at cardbus? 'Put it in' brad@ 'Go for it' deraadt@ (diff)
downloadwireguard-openbsd-51d83534623bf02037770358e071569d0e7c38e1.tar.xz
wireguard-openbsd-51d83534623bf02037770358e071569d0e7c38e1.zip
wrap logging code around WDC_DEBUG. shrinks kernel by ~4k.
jsg@ krw@ miod@ ok.
-rw-r--r--sys/dev/ic/wdc.c11
-rw-r--r--sys/dev/ic/wdcevent.h17
2 files changed, 21 insertions, 7 deletions
diff --git a/sys/dev/ic/wdc.c b/sys/dev/ic/wdc.c
index 984622bd678..71e1c1339f2 100644
--- a/sys/dev/ic/wdc.c
+++ b/sys/dev/ic/wdc.c
@@ -1,7 +1,5 @@
-/* $OpenBSD: wdc.c,v 1.98 2008/06/27 06:03:08 ray Exp $ */
-/* $NetBSD: wdc.c,v 1.68 1999/06/23 19:00:17 bouyer Exp $ */
-
-
+/* $OpenBSD: wdc.c,v 1.99 2008/06/30 00:13:30 fgsch Exp $ */
+/* $NetBSD: wdc.c,v 1.68 1999/06/23 19:00:17 bouyer Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
*
@@ -139,6 +137,7 @@ struct channel_softc_vtbl wdc_default_vtbl = {
wdc_default_write_raw_multi_4
};
+#ifdef WDC_DEBUG
static char *wdc_log_buf = NULL;
static unsigned int wdc_tail = 0;
static unsigned int wdc_head = 0;
@@ -286,7 +285,7 @@ wdc_get_log(unsigned int * size, unsigned int *left)
splx(s);
return (retbuf);
}
-
+#endif /* WDC_DEBUG */
u_int8_t
wdc_default_read_reg(chp, reg)
@@ -2291,6 +2290,7 @@ wdc_ioctl(drvp, xfer, addr, flag, p)
int error = 0;
switch (xfer) {
+#ifdef WDC_DEBUG
case ATAIOGETTRACE: {
atagettrace_t *agt = (atagettrace_t *)addr;
unsigned int size = 0;
@@ -2311,6 +2311,7 @@ wdc_ioctl(drvp, xfer, addr, flag, p)
agt->bytes_copied = size;
break;
}
+#endif
case ATAIOCCOMMAND:
/*
diff --git a/sys/dev/ic/wdcevent.h b/sys/dev/ic/wdcevent.h
index 73edec34cb1..5988a8b0f18 100644
--- a/sys/dev/ic/wdcevent.h
+++ b/sys/dev/ic/wdcevent.h
@@ -1,5 +1,4 @@
-/* $OpenBSD: wdcevent.h,v 1.4 2003/09/28 21:01:43 grange Exp $ */
-
+/* $OpenBSD: wdcevent.h,v 1.5 2008/06/30 00:13:30 fgsch Exp $ */
/*
* Copyright (c) 2001 Constantine Sapuntzakis
*
@@ -44,6 +43,7 @@ enum wdcevent_type {
#ifdef _KERNEL
+#ifdef WDC_DEBUG
void wdc_log(struct channel_softc *chp, enum wdcevent_type type,
unsigned int size, char val[]);
@@ -117,6 +117,19 @@ static __inline void WDC_LOG_ATA_CMDEXT(struct channel_softc *chp,
wdc_log(chp, WDCEVENT_ATA_EXT, 9, record);
}
+#else
+#define WDC_LOG_STATUS(chp, status)
+#define WDC_LOG_ERROR(chp, error)
+#define WDC_LOG_ATAPI_CMD(chp, drive, flags, len, cmd)
+#define WDC_LOG_ATAPI_DONE(chp, drive, flags, error)
+#define WDC_LOG_ATA_CMDSHORT(chp, cmd)
+#define WDC_LOG_ATA_CMDLONG(chp, head, precomp, cylinhi, cylinlo, \
+ sector, count, command)
+#define WDC_LOG_SET_DRIVE(chp, drive)
+#define WDC_LOG_REG(chp, reg, val)
+#define WDC_LOG_ATA_CMDEXT(chp, lba_hi1, lba_hi2, lba_mi1, lba_mi2, \
+ lba_lo1, lba_lo2, count1, count2, command)
+#endif /* WDC_DEBUG */
#endif /* _KERNEL */