Collect `#ifdef AGP_DEBUG printf(...)' into local DPRINTF macro.
This commit is contained in:
parent
44f3d26119
commit
eb10c7f5cb
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: agp_i810.c,v 1.105 2014/06/25 15:04:53 riastradh Exp $ */
|
||||
/* $NetBSD: agp_i810.c,v 1.106 2014/06/27 22:27:16 riastradh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Doug Rabson
|
||||
@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.105 2014/06/25 15:04:53 riastradh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.106 2014/06/27 22:27:16 riastradh Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -54,6 +54,13 @@ __KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.105 2014/06/25 15:04:53 riastradh Exp
|
||||
|
||||
#include "agp_intel.h"
|
||||
|
||||
#ifdef AGP_DEBUG
|
||||
#define DPRINTF(sc, fmt, ...) \
|
||||
device_printf((sc)->as_dev, "%s: " fmt, __func__, ##__VA_ARGS__)
|
||||
#else
|
||||
#define DPRINTF(sc, fmt, ...) do {} while (0)
|
||||
#endif
|
||||
|
||||
struct agp_softc *agp_i810_sc = NULL;
|
||||
|
||||
#define READ1(off) bus_space_read_1(isc->bst, isc->bsh, off)
|
||||
@ -1092,21 +1099,16 @@ agp_i810_bind_page(struct agp_softc *sc, off_t offset, bus_addr_t physical)
|
||||
struct agp_i810_softc *isc = sc->as_chipc;
|
||||
|
||||
if (offset < 0 || offset >= ((isc->gtt_size/4) << AGP_PAGE_SHIFT)) {
|
||||
#ifdef AGP_DEBUG
|
||||
printf("%s: failed"
|
||||
DPRINTF(sc, "failed"
|
||||
": offset 0x%08x, shift %d, entries %"PRIuMAX"\n",
|
||||
device_xname(sc->as_dev), (int)offset, AGP_PAGE_SHIFT,
|
||||
(int)offset, AGP_PAGE_SHIFT,
|
||||
(uintmax_t)isc->gtt_size/4);
|
||||
#endif
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if (isc->chiptype != CHIP_I810) {
|
||||
if ((offset >> AGP_PAGE_SHIFT) < isc->stolen) {
|
||||
#ifdef AGP_DEBUG
|
||||
printf("%s: trying to bind into stolen memory\n",
|
||||
device_xname(sc->as_dev));
|
||||
#endif
|
||||
DPRINTF(sc, "trying to bind into stolen memory\n");
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
@ -1124,10 +1126,7 @@ agp_i810_unbind_page(struct agp_softc *sc, off_t offset)
|
||||
|
||||
if (isc->chiptype != CHIP_I810 ) {
|
||||
if ((offset >> AGP_PAGE_SHIFT) < isc->stolen) {
|
||||
#ifdef AGP_DEBUG
|
||||
printf("%s: trying to unbind from stolen memory\n",
|
||||
device_xname(sc->as_dev));
|
||||
#endif
|
||||
DPRINTF(sc, "trying to unbind from stolen memory\n");
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
@ -1161,9 +1160,7 @@ agp_i810_alloc_memory(struct agp_softc *sc, int type, vsize_t size)
|
||||
struct agp_memory *mem;
|
||||
int error;
|
||||
|
||||
#ifdef AGP_DEBUG
|
||||
printf("AGP: alloc(%d, 0x%x)\n", type, (int) size);
|
||||
#endif
|
||||
DPRINTF(sc, "AGP: alloc(%d, 0x%x)\n", type, (int)size);
|
||||
|
||||
if (size <= 0)
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user