diff options
Diffstat (limited to 'sys/dev')
56 files changed, 599 insertions, 518 deletions
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index 840f84a4ef2..e88f397a724 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $NetBSD: acpi.c,v 1.98 2006/11/26 12:30:05 cube Exp $ */ +/* $NetBSD: acpi.c,v 1.99 2007/02/09 21:55:26 ad Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -77,7 +77,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.98 2006/11/26 12:30:05 cube Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.99 2007/02/09 21:55:26 ad Exp $"); #include "opt_acpi.h" #include "opt_pcifixup.h" @@ -562,7 +562,8 @@ acpi_activate_device(ACPI_HANDLE handle, ACPI_DEVICE_INFO **di) aprint_error("acpi: activate failed for %s\n", (*di)->HardwareId.Value); } else { - aprint_normal("acpi: activated %s\n", (*di)->HardwareId.Value); + aprint_verbose("acpi: activated %s\n", + (*di)->HardwareId.Value); } (void)AcpiGetObjectInfo(handle, &buf); @@ -752,7 +753,7 @@ acpi_enable_fixed_events(struct acpi_softc *sc) */ if (AcpiGbl_FADT != NULL && AcpiGbl_FADT->PwrButton == 0) { - aprint_normal("%s: fixed-feature power button present\n", + aprint_verbose("%s: fixed-feature power button present\n", sc->sc_dev.dv_xname); sc->sc_smpsw_power.smpsw_name = sc->sc_dev.dv_xname; sc->sc_smpsw_power.smpsw_type = PSWITCH_TYPE_POWER; @@ -773,7 +774,7 @@ acpi_enable_fixed_events(struct acpi_softc *sc) } if (AcpiGbl_FADT != NULL && AcpiGbl_FADT->SleepButton == 0) { - aprint_normal("%s: fixed-feature sleep button present\n", + aprint_verbose("%s: fixed-feature sleep button present\n", sc->sc_dev.dv_xname); sc->sc_smpsw_sleep.smpsw_name = sc->sc_dev.dv_xname; sc->sc_smpsw_sleep.smpsw_type = PSWITCH_TYPE_SLEEP; diff --git a/sys/dev/adb/adb_bus.c b/sys/dev/adb/adb_bus.c index db6047044bc..6b245353af2 100644 --- a/sys/dev/adb/adb_bus.c +++ b/sys/dev/adb/adb_bus.c @@ -1,4 +1,4 @@ -/* $NetBSD: adb_bus.c,v 1.2 2007/02/09 21:06:48 macallan Exp $ */ +/* $NetBSD: adb_bus.c,v 1.3 2007/02/09 21:55:27 ad Exp $ */ /*- * Copyright (c) 2006 Michael Lorenz @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: adb_bus.c,v 1.2 2007/02/09 21:06:48 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: adb_bus.c,v 1.3 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -111,8 +111,8 @@ nadb_init(struct device *dev) } /* bus reset (?) */ - nadb_send_sync(sc, 0, 0, NULL); - delay(200000); + //nadb_send_sync(sc, 0, 0, NULL); + //delay(200000); /* * scan only addresses 1 - 7 diff --git a/sys/dev/adb/adb_ms.c b/sys/dev/adb/adb_ms.c index 1746857526c..a4f3ed45334 100644 --- a/sys/dev/adb/adb_ms.c +++ b/sys/dev/adb/adb_ms.c @@ -1,4 +1,4 @@ -/* $NetBSD: adb_ms.c,v 1.2 2007/02/09 21:07:37 macallan Exp $ */ +/* $NetBSD: adb_ms.c,v 1.3 2007/02/09 21:55:27 ad Exp $ */ /* * Copyright (C) 1998 Colin Wood @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.2 2007/02/09 21:07:37 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.3 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -42,7 +42,6 @@ __KERNEL_RCSID(0, "$NetBSD: adb_ms.c,v 1.2 2007/02/09 21:07:37 macallan Exp $"); #include <sys/signalvar.h> #include <sys/systm.h> #include <sys/kernel.h> -#include <sys/sysctl.h> #include <machine/autoconf.h> @@ -86,7 +85,6 @@ struct adbms_softc { * always down */ int sc_x, sc_y; - int sc_tapping; /* buffers */ int sc_poll; int sc_msg_len; @@ -131,7 +129,6 @@ static void adbms_mangle_2(struct adbms_softc *, int); static void adbms_mangle_4(struct adbms_softc *, int); static void adbms_handler(void *, int, uint8_t *); static int adbms_wait(struct adbms_softc *, int); -static int sysctl_adbms_tap(SYSCTLFN_ARGS); const struct wsmouse_accessops adbms_accessops = { adbms_enable, @@ -171,7 +168,6 @@ adbms_attach(struct device *parent, struct device *self, void *aux) sc->sc_devid[4] = 0; sc->sc_poll = 0; sc->sc_msg_len = 0; - sc->sc_tapping = 1; ems_init(sc); @@ -566,22 +562,20 @@ adbms_process_event(struct adbms_softc *sc, int len, uint8_t *buffer) if (sc->sc_class == MSCLASS_TRACKPAD) { - if (sc->sc_tapping == 1) { - if (sc->sc_down) { - /* finger is down - collect motion data */ - sc->sc_x += dx; - sc->sc_y += dy; - } - DPRINTF("buttons: %02x\n", buttons); - switch (sc->sc_buttons) { - case 2: - buttons |= ((buttons & 2) >> 1); - adbms_mangle_2(sc, buttons); - break; - case 4: - adbms_mangle_4(sc, buttons); - break; - } + if (sc->sc_down) { + /* finger is down - collect motion data */ + sc->sc_x += dx; + sc->sc_y += dy; + } + DPRINTF("buttons: %02x\n", buttons); + switch (sc->sc_buttons) { + case 2: + buttons |= ((buttons & 2) >> 1); + adbms_mangle_2(sc, buttons); + break; + case 4: + adbms_mangle_4(sc, buttons); + break; } /* filter the pseudo-buttons out */ buttons &= 1; @@ -689,8 +683,7 @@ adbms_disable(void *v) static void init_trackpad(struct adbms_softc *sc) { - struct sysctlnode *me = NULL, *node = NULL; - int cmd, addr, ret; + int cmd, addr; uint8_t buffer[16]; uint8_t b2[] = {0x99, 0x94, 0x19, 0xff, 0xb2, 0x8a, 0x1b, 0x50}; @@ -721,28 +714,6 @@ init_trackpad(struct adbms_softc *sc) cmd = ADBFLUSH(addr); adbms_send_sync(sc, cmd, 0, NULL); delay(1000); - - /* - * setup a sysctl node to control wether tapping the pad should - * trigger mouse button events - */ - - sc->sc_tapping = 1; - - ret = sysctl_createv(NULL, 0, NULL, (const struct sysctlnode **)&me, - CTLFLAG_READWRITE, - CTLTYPE_NODE, sc->sc_dev.dv_xname, NULL, - NULL, 0, NULL, 0, - CTL_MACHDEP, CTL_CREATE, CTL_EOL); - - ret = sysctl_createv(NULL, 0, NULL, (const struct sysctlnode **)&node, - CTLFLAG_READWRITE | CTLFLAG_OWNDESC | CTLFLAG_IMMEDIATE, - CTLTYPE_INT, "tapping", "tapping the pad causes button events", - sysctl_adbms_tap, 1, NULL, 0, - CTL_MACHDEP, me->sysctl_num, CTL_CREATE, CTL_EOL); - if (node != NULL) { - node->sysctl_data = sc; - } } static int @@ -777,40 +748,3 @@ adbms_send_sync(struct adbms_softc *sc, uint8_t cmd, int len, uint8_t *msg) adbms_wait(sc, 1000); return (sc->sc_msg_len != -1); } - -static int -sysctl_adbms_tap(SYSCTLFN_ARGS) -{ - struct sysctlnode node = *rnode; - struct adbms_softc *sc = node.sysctl_data; - - node.sysctl_idata = sc->sc_tapping; - - if (newp) { - - /* we're asked to write */ - node.sysctl_data = &sc->sc_tapping; - if (sysctl_lookup(SYSCTLFN_CALL(&node)) == 0) { - - sc->sc_tapping = (node.sysctl_idata == 0) ? 0 : 1; - return 0; - } - return EINVAL; - } else { - - node.sysctl_size = 4; - return (sysctl_lookup(SYSCTLFN_CALL(&node))); - } - - return 0; -} - -SYSCTL_SETUP(sysctl_ams_setup, "sysctl ams subtree setup") -{ - - sysctl_createv(NULL, 0, NULL, NULL, - CTLFLAG_PERMANENT, - CTLTYPE_NODE, "machdep", NULL, - NULL, 0, NULL, 0, - CTL_MACHDEP, CTL_EOL); -} diff --git a/sys/dev/adb/files.adb b/sys/dev/adb/files.adb index 61fc8ef24ed..e69de29bb2d 100644 --- a/sys/dev/adb/files.adb +++ b/sys/dev/adb/files.adb @@ -1,23 +0,0 @@ -# -# $NetBSD: files.adb,v 1.1 2007/01/17 23:20:16 macallan Exp $ -# -# Apple Desktop Bus protocol and drivers - -defflag adbdebug.h ADB_DEBUG -defflag adbdebug.h ADBKBD_DEBUG -defflag adbdebug.h ADBMS_DEBUG -defflag adbdebug.h ADBKBD_POWER_PANIC - -define adb_bus {} - -device nadb {} -attach nadb at adb_bus -file dev/adb/adb_bus.c nadb needs-flag - -device adbkbd : wskbddev, wsmousedev -attach adbkbd at nadb -file dev/adb/adb_kbd.c adbkbd needs-flag - -device adbms : wsmousedev -attach adbms at nadb -file dev/adb/adb_ms.c adbms needs-flag diff --git a/sys/dev/ata/ata.c b/sys/dev/ata/ata.c index 48e76f34421..ade1dab8040 100644 --- a/sys/dev/ata/ata.c +++ b/sys/dev/ata/ata.c @@ -1,4 +1,4 @@ -/* $NetBSD: ata.c,v 1.84 2006/12/25 18:36:05 wiz Exp $ */ +/* $NetBSD: ata.c,v 1.85 2007/02/09 21:55:27 ad Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.84 2006/12/25 18:36:05 wiz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.85 2007/02/09 21:55:27 ad Exp $"); #ifndef ATADEBUG #define ATADEBUG @@ -1023,24 +1023,24 @@ ata_print_modes(struct ata_channel *chp) drvp = &chp->ch_drive[drive]; if ((drvp->drive_flags & DRIVE) == 0 || drvp->drv_softc == NULL) continue; - aprint_normal("%s(%s:%d:%d): using PIO mode %d", + aprint_verbose("%s(%s:%d:%d): using PIO mode %d", drvp->drv_softc->dv_xname, atac->atac_dev.dv_xname, chp->ch_channel, drvp->drive, drvp->PIO_mode); #if NATA_DMA if (drvp->drive_flags & DRIVE_DMA) - aprint_normal(", DMA mode %d", drvp->DMA_mode); + aprint_verbose(", DMA mode %d", drvp->DMA_mode); #if NATA_UDMA if (drvp->drive_flags & DRIVE_UDMA) { - aprint_normal(", Ultra-DMA mode %d", drvp->UDMA_mode); + aprint_verbose(", Ultra-DMA mode %d", drvp->UDMA_mode); if (drvp->UDMA_mode == 2) - aprint_normal(" (Ultra/33)"); + aprint_verbose(" (Ultra/33)"); else if (drvp->UDMA_mode == 4) - aprint_normal(" (Ultra/66)"); + aprint_verbose(" (Ultra/66)"); else if (drvp->UDMA_mode == 5) - aprint_normal(" (Ultra/100)"); + aprint_verbose(" (Ultra/100)"); else if (drvp->UDMA_mode == 6) - aprint_normal(" (Ultra/133)"); + aprint_verbose(" (Ultra/133)"); } #endif /* NATA_UDMA */ #endif /* NATA_DMA */ @@ -1054,9 +1054,9 @@ ata_print_modes(struct ata_channel *chp) || (atac->atac_cap & ATAC_CAP_PIOBM) #endif ) - aprint_normal(" (using DMA)"); + aprint_verbose(" (using DMA)"); #endif /* NATA_DMA || NATA_PIOBM */ - aprint_normal("\n"); + aprint_verbose("\n"); } } @@ -1151,7 +1151,7 @@ ata_probe_caps(struct ata_drive_datas *drvp) drvp->drive_flags &= ~DRIVE_CAP32; splx(s); } else { - aprint_normal("%s: 32-bit data port\n", + aprint_verbose("%s: 32-bit data port\n", drv_dev->dv_xname); } } @@ -1160,7 +1160,7 @@ ata_probe_caps(struct ata_drive_datas *drvp) params.atap_ata_major != 0xffff) { for (i = 14; i > 0; i--) { if (params.atap_ata_major & (1 << i)) { - aprint_normal("%s: ATA version %d\n", + aprint_verbose("%s: ATA version %d\n", drv_dev->dv_xname, i); drvp->ata_vers = i; break; @@ -1206,7 +1206,7 @@ ata_probe_caps(struct ata_drive_datas *drvp) AT_WAIT) != CMD_OK) continue; if (!printed) { - aprint_normal("%s: drive supports PIO mode %d", + aprint_verbose("%s: drive supports PIO mode %d", drv_dev->dv_xname, i + 3); sep = ","; printed = 1; @@ -1244,7 +1244,7 @@ ata_probe_caps(struct ata_drive_datas *drvp) continue; #endif if (!printed) { - aprint_normal("%s DMA mode %d", sep, i); + aprint_verbose("%s DMA mode %d", sep, i); sep = ","; printed = 1; } @@ -1276,16 +1276,16 @@ ata_probe_caps(struct ata_drive_datas *drvp) continue; #endif if (!printed) { - aprint_normal("%s Ultra-DMA mode %d", + aprint_verbose("%s Ultra-DMA mode %d", sep, i); if (i == 2) - aprint_normal(" (Ultra/33)"); + aprint_verbose(" (Ultra/33)"); else if (i == 4) - aprint_normal(" (Ultra/66)"); + aprint_verbose(" (Ultra/66)"); else if (i == 5) - aprint_normal(" (Ultra/100)"); + aprint_verbose(" (Ultra/100)"); else if (i == 6) - aprint_normal(" (Ultra/133)"); + aprint_verbose(" (Ultra/133)"); sep = ","; printed = 1; } @@ -1304,7 +1304,7 @@ ata_probe_caps(struct ata_drive_datas *drvp) break; } } - aprint_normal("\n"); + aprint_verbose("\n"); } s = splbio(); diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c index 5885d18aefb..8aecf8bdee1 100644 --- a/sys/dev/ata/wd.c +++ b/sys/dev/ata/wd.c @@ -1,4 +1,4 @@ -/* $NetBSD: wd.c,v 1.335 2006/11/16 01:32:48 christos Exp $ */ +/* $NetBSD: wd.c,v 1.336 2007/02/09 21:55:27 ad Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.335 2006/11/16 01:32:48 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.336 2007/02/09 21:55:27 ad Exp $"); #ifndef ATADEBUG #define ATADEBUG @@ -358,7 +358,7 @@ wdattach(struct device *parent, struct device *self, void *aux) wd->sc_multi = 1; } - aprint_normal("%s: drive supports %d-sector PIO transfers,", + aprint_verbose("%s: drive supports %d-sector PIO transfers,", wd->sc_dev.dv_xname, wd->sc_multi); /* 48-bit LBA addressing */ @@ -376,19 +376,19 @@ wdattach(struct device *parent, struct device *self, void *aux) #endif if ((wd->sc_flags & WDF_LBA48) != 0) { - aprint_normal(" LBA48 addressing\n"); + aprint_verbose(" LBA48 addressing\n"); wd->sc_capacity = ((u_int64_t) wd->sc_params.__reserved6[11] << 48) | ((u_int64_t) wd->sc_params.__reserved6[10] << 32) | ((u_int64_t) wd->sc_params.__reserved6[9] << 16) | ((u_int64_t) wd->sc_params.__reserved6[8] << 0); } else if ((wd->sc_flags & WDF_LBA) != 0) { - aprint_normal(" LBA addressing\n"); + aprint_verbose(" LBA addressing\n"); wd->sc_capacity = ((u_int64_t)wd->sc_params.atap_capacity[1] << 16) | wd->sc_params.atap_capacity[0]; } else { - aprint_normal(" chs addressing\n"); + aprint_verbose(" chs addressing\n"); wd->sc_capacity = wd->sc_params.atap_cylinders * wd->sc_params.atap_heads * diff --git a/sys/dev/audio.c b/sys/dev/audio.c index 2ea82d47203..ebc4605c931 100644 --- a/sys/dev/audio.c +++ b/sys/dev/audio.c @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.215 2006/11/16 01:32:44 christos Exp $ */ +/* $NetBSD: audio.c,v 1.216 2007/02/09 21:55:26 ad Exp $ */ /* * Copyright (c) 1991-1993 Regents of the University of California. @@ -61,7 +61,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.215 2006/11/16 01:32:44 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.216 2007/02/09 21:55:26 ad Exp $"); #include "audio.h" #if NAUDIO > 0 @@ -174,6 +174,9 @@ int audioactivate(struct device *, enum devact); void audio_powerhook(int, void *); +static void audio_softintr_rd(void *); +static void audio_softintr_wr(void *); + struct portname { const char *name; int mask; @@ -333,6 +336,11 @@ audioattach(struct device *parent, struct device *self, void *aux) return; } + sc->sc_sih_rd = softintr_establish(IPL_SOFTSERIAL, + audio_softintr_rd, sc); + sc->sc_sih_wr = softintr_establish(IPL_SOFTSERIAL, + audio_softintr_wr, sc); + iclass = mclass = oclass = rclass = -1; sc->sc_inports.index = -1; sc->sc_inports.master = -1; @@ -522,6 +530,14 @@ audiodetach(struct device *self, int flags) powerhook_disestablish(sc->sc_powerhook); sc->sc_powerhook = NULL; } + if (sc->sc_sih_rd) { + softintr_disestablish(sc->sc_sih_rd); + sc->sc_sih_rd = NULL; + } + if (sc->sc_sih_wr) { + softintr_disestablish(sc->sc_sih_wr); + sc->sc_sih_wr = NULL; + } return 0; } @@ -2492,6 +2508,40 @@ audio_pint_silence(struct audio_softc *sc, struct audio_ringbuffer *cb, } } +static void +audio_softintr_rd(void *cookie) +{ + struct audio_softc *sc = cookie; + struct proc *p; + + selnotify(&sc->sc_rsel, 0); + if (sc->sc_async_audio != NULL) { + DPRINTFN(3, ("audio_softintr_rd: sending SIGIO %p\n", + sc->sc_async_audio)); + mutex_enter(&proclist_mutex); + if ((p = sc->sc_async_audio) != NULL) + psignal(p, SIGIO); + mutex_exit(&proclist_mutex); + } +} + +static void +audio_softintr_wr(void *cookie) +{ + struct audio_softc *sc = cookie; + struct proc *p; + + selnotify(&sc->sc_wsel, 0); + if (sc->sc_async_audio != NULL) { + DPRINTFN(3, ("audio_softintr_wr: sending SIGIO %p\n", + sc->sc_async_audio)); + mutex_enter(&proclist_mutex); + if ((p = sc->sc_async_audio) != NULL) + psignal(p, SIGIO); + mutex_exit(&proclist_mutex); + } +} + /* * Called from HW driver module on completion of DMA output. * Start output of new block, wrap in ring buffer if needed. @@ -2623,21 +2673,14 @@ audio_pint(void *v) if ((sc->sc_mode & AUMODE_PLAY) && !cb->pause) { if (audio_stream_get_used(sc->sc_pustream) <= cb->usedlow) { audio_wakeup(&sc->sc_wchan); - selnotify(&sc->sc_wsel, 0); - if (sc->sc_async_audio) { - DPRINTFN(3, ("audio_pint: sending SIGIO %p\n", - sc->sc_async_audio)); - psignal(sc->sc_async_audio, SIGIO); - } + softintr_schedule(sc->sc_sih_wr); } } /* Possible to return one or more "phantom blocks" now. */ if (!sc->sc_full_duplex && sc->sc_rchan) { audio_wakeup(&sc->sc_rchan); - selnotify(&sc->sc_rsel, 0); - if (sc->sc_async_audio) - psignal(sc->sc_async_audio, SIGIO); + softintr_schedule(sc->sc_sih_rd); } } @@ -2744,9 +2787,7 @@ audio_rint(void *v) } audio_wakeup(&sc->sc_rchan); - selnotify(&sc->sc_rsel, 0); - if (sc->sc_async_audio) - psignal(sc->sc_async_audio, SIGIO); + softintr_schedule(sc->sc_sih_rd); } int @@ -3625,8 +3666,11 @@ mixer_signal(struct audio_softc *sc) { struct mixer_asyncs *m; - for (m = sc->sc_async_mixer; m; m = m->next) + for (m = sc->sc_async_mixer; m; m = m->next) { + mutex_enter(&proclist_mutex); psignal(m->proc, SIGIO); + mutex_exit(&proclist_mutex); + } } /* diff --git a/sys/dev/audiovar.h b/sys/dev/audiovar.h index 65097340154..37ac7e938f7 100644 --- a/sys/dev/audiovar.h +++ b/sys/dev/audiovar.h @@ -1,4 +1,4 @@ -/* $NetBSD: audiovar.h,v 1.37 2006/06/19 10:19:08 jmcneill Exp $ */ +/* $NetBSD: audiovar.h,v 1.38 2007/02/09 21:55:26 ad Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -138,6 +138,8 @@ struct audio_softc { struct selinfo sc_wsel; /* write selector */ struct selinfo sc_rsel; /* read selector */ struct proc *sc_async_audio; /* process who wants audio SIGIO */ + void *sc_sih_rd; + void *sc_sih_wr; struct mixer_asyncs { struct mixer_asyncs *next; struct proc *proc; diff --git a/sys/dev/cons.c b/sys/dev/cons.c index 1e440494f51..4026c8f0d40 100644 --- a/sys/dev/cons.c +++ b/sys/dev/cons.c @@ -1,4 +1,4 @@ -/* $NetBSD: cons.c,v 1.61 2006/11/16 01:32:45 christos Exp $ */ +/* $NetBSD: cons.c,v 1.62 2007/02/09 21:55:26 ad Exp $ */ /* * Copyright (c) 1990, 1993 @@ -78,7 +78,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.61 2006/11/16 01:32:45 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.62 2007/02/09 21:55:26 ad Exp $"); #include <sys/param.h> #include <sys/proc.h> @@ -92,6 +92,7 @@ __KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.61 2006/11/16 01:32:45 christos Exp $"); #include <sys/conf.h> #include <sys/vnode.h> #include <sys/kauth.h> +#include <sys/mutex.h> #include <dev/cons.h> @@ -232,17 +233,24 @@ cnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct lwp *l) const struct cdevsw *cdev; int error; + error = 0; + /* * Superuser can always use this to wrest control of console * output from the "virtual" console. */ +#ifdef notyet + mutex_enter(&tty_mutex); +#endif if (cmd == TIOCCONS && constty != NULL) { error = kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, NULL); - if (error) - return (error); - constty = NULL; - return (0); + if (!error) + constty = NULL; +#ifdef notyet + mutex_exit(&tty_mutex); +#endif + return (error); } /* @@ -252,9 +260,12 @@ cnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct lwp *l) * out from under it. */ cdev = cn_redirect(&dev, 0, &error); - if (cdev == NULL) - return error; - return ((*cdev->d_ioctl)(dev, cmd, data, flag, l)); +#ifdef notyet + mutex_exit(&tty_mutex); +#endif + if (cdev != NULL) + error = (*cdev->d_ioctl)(dev, cmd, data, flag, l); + return (error); } /*ARGSUSED*/ @@ -407,15 +418,17 @@ cnhalt(void) (*cn_tab->cn_halt)(cn_tab->cn_dev); } +/* + * Redirect output, if that's appropriate. If there's no real console, + * return ENXIO. + * + * Call with tty_mutex held. + */ static const struct cdevsw * cn_redirect(dev_t *devp, int is_read, int *error) { dev_t dev = *devp; - /* - * Redirect output, if that's appropriate. - * If there's no real console, return ENXIO. - */ *error = ENXIO; if (constty != NULL && minor(dev) == 0 && (cn_tab == NULL || (cn_tab->cn_pri != CN_REMOTE))) { diff --git a/sys/dev/ic/cac.c b/sys/dev/ic/cac.c index 6eeae583569..fac89bd5336 100644 --- a/sys/dev/ic/cac.c +++ b/sys/dev/ic/cac.c @@ -1,7 +1,7 @@ -/* $NetBSD: cac.c,v 1.38 2006/12/29 14:07:08 ad Exp $ */ +/* $NetBSD: cac.c,v 1.39 2007/02/09 21:55:27 ad Exp $ */ /*- - * Copyright (c) 2000, 2006 The NetBSD Foundation, Inc. + * Copyright (c) 2000, 2006, 2007 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cac.c,v 1.38 2006/12/29 14:07:08 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cac.c,v 1.39 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -108,6 +108,8 @@ cac_init(struct cac_softc *sc, const char *intrstr, int startfw) SIMPLEQ_INIT(&sc->sc_ccb_free); SIMPLEQ_INIT(&sc->sc_ccb_queue); + mutex_init(&sc->sc_mutex, MUTEX_DRIVER, IPL_BIO); + cv_init(&sc->sc_ccb_cv, "cacccb"); size = sizeof(struct cac_ccb) * CAC_MAX_CCBS; @@ -197,7 +199,10 @@ cac_init(struct cac_softc *sc, const char *intrstr, int startfw) if (cac_sdh == NULL) cac_sdh = shutdownhook_establish(cac_shutdown, NULL); + mutex_enter(&sc->sc_mutex); (*sc->sc_cl.cl_intr_enable)(sc, CAC_INTR_ENABLE); + mutex_exit(&sc->sc_mutex); + return (0); } @@ -247,22 +252,24 @@ cac_intr(void *cookie) { struct cac_softc *sc; struct cac_ccb *ccb; + int rv; sc = (struct cac_softc *)cookie; - if (!(*sc->sc_cl.cl_intr_pending)(sc)) { -#ifdef DEBUG - printf("%s: spurious intr\n", sc->sc_dv.dv_xname); -#endif - return (0); - } + mutex_enter(&sc->sc_mutex); - while ((ccb = (*sc->sc_cl.cl_completed)(sc)) != NULL) { - cac_ccb_done(sc, ccb); - cac_ccb_start(sc, NULL); - } + if ((*sc->sc_cl.cl_intr_pending)(sc)) { + while ((ccb = (*sc->sc_cl.cl_completed)(sc)) != NULL) { + cac_ccb_done(sc, ccb); + cac_ccb_start(sc, NULL); + } + rv = 1; + } else + rv = 0; + + mutex_exit(&sc->sc_mutex); - return (1); + return (rv); } /* @@ -274,7 +281,7 @@ cac_cmd(struct cac_softc *sc, int command, void *data, int datasize, { struct cac_ccb *ccb; struct cac_sgb *sgb; - int s, i, rv, size, nsegs; + int i, rv, size, nsegs; size = 0; @@ -324,9 +331,10 @@ cac_cmd(struct cac_softc *sc, int command, void *data, int datasize, ccb->ccb_flags = flags; ccb->ccb_datasize = size; + mutex_enter(&sc->sc_mutex); + if (context == NULL) { memset(&ccb->ccb_context, 0, sizeof(struct cac_context)); - s = splbio(); /* Synchronous commands musn't wait. */ if ((*sc->sc_cl.cl_fifo_full)(sc)) { @@ -342,23 +350,24 @@ cac_cmd(struct cac_softc *sc, int command, void *data, int datasize, } } else { memcpy(&ccb->ccb_context, context, sizeof(struct cac_context)); - s = splbio(); (void)cac_ccb_start(sc, ccb); rv = 0; } - splx(s); + mutex_exit(&sc->sc_mutex); return (rv); } /* - * Wait for the specified CCB to complete. Must be called at splbio. + * Wait for the specified CCB to complete. */ static int cac_ccb_poll(struct cac_softc *sc, struct cac_ccb *wantccb, int timo) { struct cac_ccb *ccb; + LOCK_ASSERT(mutex_owned(&sc->sc_mutex)); + timo *= 1000; do { @@ -381,12 +390,14 @@ cac_ccb_poll(struct cac_softc *sc, struct cac_ccb *wantccb, int timo) /* * Enqueue the specified command (if any) and attempt to start all enqueued - * commands. Must be called at splbio. + * commands. */ static int cac_ccb_start(struct cac_softc *sc, struct cac_ccb *ccb) { + LOCK_ASSERT(mutex_owned(&sc->sc_mutex)); + if (ccb != NULL) SIMPLEQ_INSERT_TAIL(&sc->sc_ccb_queue, ccb, ccb_chain); @@ -415,6 +426,8 @@ cac_ccb_done(struct cac_softc *sc, struct cac_ccb *ccb) error = 0; + LOCK_ASSERT(mutex_owned(&sc->sc_mutex)); + #ifdef DIAGNOSTIC if ((ccb->ccb_flags & CAC_CCB_ACTIVE) == 0) panic("cac_ccb_done: CCB not active"); @@ -454,9 +467,8 @@ static struct cac_ccb * cac_ccb_alloc(struct cac_softc *sc, int nosleep) { struct cac_ccb *ccb; - int s; - s = splbio(); + mutex_enter(&sc->sc_mutex); for (;;) { if ((ccb = SIMPLEQ_FIRST(&sc->sc_ccb_free)) != NULL) { @@ -467,10 +479,10 @@ cac_ccb_alloc(struct cac_softc *sc, int nosleep) ccb = NULL; break; } - tsleep(&sc->sc_ccb_free, PRIBIO, "cacccb", 0); + cv_wait(&sc->sc_ccb_cv, &sc->sc_mutex); } - splx(s); + mutex_exit(&sc->sc_mutex); return (ccb); } @@ -480,14 +492,13 @@ cac_ccb_alloc(struct cac_softc *sc, int nosleep) static void cac_ccb_free(struct cac_softc *sc, struct cac_ccb *ccb) { - int s; + + LOCK_ASSERT(mutex_owned(&sc->sc_mutex)); ccb->ccb_flags = 0; - s = splbio(); + if (SIMPLEQ_EMPTY(&sc->sc_ccb_free)) + cv_signal(&sc->sc_ccb_cv); SIMPLEQ_INSERT_HEAD(&sc->sc_ccb_free, ccb, ccb_chain); - if (SIMPLEQ_NEXT(ccb, ccb_chain) == NULL) - wakeup_one(&sc->sc_ccb_free); - splx(s); } /* @@ -498,6 +509,8 @@ static int cac_l0_fifo_full(struct cac_softc *sc) { + LOCK_ASSERT(mutex_owned(&sc->sc_mutex)); + return (cac_inl(sc, CAC_REG_CMD_FIFO) == 0); } @@ -505,6 +518,8 @@ static void cac_l0_submit(struct cac_softc *sc, struct cac_ccb *ccb) { + LOCK_ASSERT(mutex_owned(&sc->sc_mutex)); + bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, (caddr_t)ccb - sc->sc_ccbs, sizeof(struct cac_ccb), BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); cac_outl(sc, CAC_REG_CMD_FIFO, ccb->ccb_paddr); @@ -516,6 +531,8 @@ cac_l0_completed(struct cac_softc *sc) struct cac_ccb *ccb; paddr_t off; + LOCK_ASSERT(mutex_owned(&sc->sc_mutex)); + if ((off = cac_inl(sc, CAC_REG_DONE_FIFO)) == 0) return (NULL); @@ -539,6 +556,8 @@ static int cac_l0_intr_pending(struct cac_softc *sc) { + LOCK_ASSERT(mutex_owned(&sc->sc_mutex)); + return (cac_inl(sc, CAC_REG_INTR_PENDING) & CAC_INTR_ENABLE); } @@ -546,6 +565,8 @@ static void cac_l0_intr_enable(struct cac_softc *sc, int state) { + LOCK_ASSERT(mutex_owned(&sc->sc_mutex)); + cac_outl(sc, CAC_REG_INTR_MASK, state ? CAC_INTR_ENABLE : CAC_INTR_DISABLE); } diff --git a/sys/dev/ic/cacvar.h b/sys/dev/ic/cacvar.h index a5d48e71ee3..d6f9a7a9aef 100644 --- a/sys/dev/ic/cacvar.h +++ b/sys/dev/ic/cacvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: cacvar.h,v 1.13 2006/12/28 19:17:12 ad Exp $ */ +/* $NetBSD: cacvar.h,v 1.14 2007/02/09 21:55:27 ad Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -39,6 +39,9 @@ #ifndef _IC_CACVAR_H_ #define _IC_CACVAR_H_ +#include <sys/mutex.h> +#include <sys/condvar.h> + #define CAC_MAX_CCBS 256 #define CAC_MAX_XFER (0xffff * 512) #define CAC_SG_SIZE 32 @@ -106,6 +109,7 @@ struct cac_linkage { struct cac_softc { struct device sc_dv; + kmutex_t sc_mutex; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; bus_dma_tag_t sc_dmat; @@ -116,6 +120,7 @@ struct cac_softc { paddr_t sc_ccbs_paddr; SIMPLEQ_HEAD(, cac_ccb) sc_ccb_free; SIMPLEQ_HEAD(, cac_ccb) sc_ccb_queue; + kcondvar_t sc_ccb_cv; struct cac_linkage sc_cl; }; diff --git a/sys/dev/ic/ld_cac.c b/sys/dev/ic/ld_cac.c index 6059ffe58cc..a4876e44f02 100644 --- a/sys/dev/ic/ld_cac.c +++ b/sys/dev/ic/ld_cac.c @@ -1,7 +1,7 @@ -/* $NetBSD: ld_cac.c,v 1.16 2006/11/28 20:29:14 ad Exp $ */ +/* $NetBSD: ld_cac.c,v 1.17 2007/02/09 21:55:27 ad Exp $ */ /*- - * Copyright (c) 2000 The NetBSD Foundation, Inc. + * Copyright (c) 2000, 2006 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ld_cac.c,v 1.16 2006/11/28 20:29:14 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ld_cac.c,v 1.17 2007/02/09 21:55:27 ad Exp $"); #include "rnd.h" @@ -67,9 +67,10 @@ __KERNEL_RCSID(0, "$NetBSD: ld_cac.c,v 1.16 2006/11/28 20:29:14 ad Exp $"); struct ld_cac_softc { struct ld_softc sc_ld; + kmutex_t *sc_mutex; int sc_hwunit; - struct timeval sc_serrtm; int sc_serrcnt; + struct timeval sc_serrtm; }; void ld_cac_attach(struct device *, struct device *, void *); @@ -106,6 +107,7 @@ ld_cac_attach(struct device *parent, struct device *self, void *aux) caca = (struct cac_attach_args *)aux; sc->sc_hwunit = caca->caca_unit; cac = (struct cac_softc *)parent; + sc->sc_mutex = &cac->sc_mutex; if (cac_cmd(cac, CAC_CMD_GET_LOG_DRV_INFO, &dinfo, sizeof(dinfo), sc->sc_hwunit, 0, CAC_CCB_DATA_IN, NULL)) { @@ -194,6 +196,7 @@ ld_cac_done(struct device *dv, void *context, int error) bp = context; rv = 0; + sc = device_private(dv); if ((error & CAC_RET_CMD_REJECTED) == CAC_RET_CMD_REJECTED) { printf("%s: command rejected\n", dv->dv_xname); @@ -208,12 +211,11 @@ ld_cac_done(struct device *dv, void *context, int error) rv = EIO; } if (rv == 0 && (error & CAC_RET_SOFT_ERROR) != 0) { - sc = (struct ld_cac_softc *)dv; sc->sc_serrcnt++; if (ratecheck(&sc->sc_serrtm, &ld_cac_serrintvl)) { + sc->sc_serrcnt = 0; printf("%s: %d soft errors; array may be degraded\n", dv->dv_xname, sc->sc_serrcnt); - sc->sc_serrcnt = 0; } } @@ -224,5 +226,7 @@ ld_cac_done(struct device *dv, void *context, int error) } else bp->b_resid = 0; + mutex_exit(sc->sc_mutex); lddone((struct ld_softc *)dv, bp); + mutex_enter(sc->sc_mutex); } diff --git a/sys/dev/kttcp.c b/sys/dev/kttcp.c index 3e461dc0733..dc3094409c6 100644 --- a/sys/dev/kttcp.c +++ b/sys/dev/kttcp.c @@ -1,4 +1,4 @@ -/* $NetBSD: kttcp.c,v 1.22 2006/12/28 02:09:49 hubertf Exp $ */ +/* $NetBSD: kttcp.c,v 1.23 2007/02/09 21:55:26 ad Exp $ */ /* * Copyright (c) 2002 Wasabi Systems, Inc. @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kttcp.c,v 1.22 2006/12/28 02:09:49 hubertf Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kttcp.c,v 1.23 2007/02/09 21:55:26 ad Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -58,7 +58,6 @@ __KERNEL_RCSID(0, "$NetBSD: kttcp.c,v 1.22 2006/12/28 02:09:49 hubertf Exp $"); #include <sys/socketvar.h> #include <sys/socket.h> #include <sys/mbuf.h> -#include <sys/sa.h> #include <sys/mount.h> #include <sys/syscallargs.h> diff --git a/sys/dev/ld.c b/sys/dev/ld.c index b7550f2e799..cc3074d3247 100644 --- a/sys/dev/ld.c +++ b/sys/dev/ld.c @@ -1,4 +1,4 @@ -/* $NetBSD: ld.c,v 1.43 2007/02/08 03:19:42 riz Exp $ */ +/* $NetBSD: ld.c,v 1.44 2007/02/09 21:55:26 ad Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.43 2007/02/08 03:19:42 riz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.44 2007/02/09 21:55:26 ad Exp $"); #include "rnd.h" @@ -63,6 +63,7 @@ __KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.43 2007/02/08 03:19:42 riz Exp $"); #include <sys/fcntl.h> #include <sys/vnode.h> #include <sys/syslog.h> +#include <sys/mutex.h> #if NRND > 0 #include <sys/rnd.h> #endif @@ -75,7 +76,7 @@ static void ldgetdefaultlabel(struct ld_softc *, struct disklabel *); static void ldgetdisklabel(struct ld_softc *); static void ldminphys(struct buf *bp); static void ldshutdown(void *); -static void ldstart(struct ld_softc *); +static void ldstart(struct ld_softc *, struct buf *); static void ld_set_properties(struct ld_softc *); extern struct cfdriver ld_cd; @@ -106,6 +107,8 @@ ldattach(struct ld_softc *sc) { char tbuf[9]; + mutex_init(&sc->sc_mutex, MUTEX_DRIVER, IPL_BIO); + if ((sc->sc_flags & LDF_ENABLED) == 0) { aprint_normal("%s: disabled\n", sc->sc_dv.dv_xname); return; @@ -598,8 +601,7 @@ ldstrategy(struct buf *bp) bp->b_rawblkno = blkno; s = splbio(); - BUFQ_PUT(sc->sc_bufq, bp); - ldstart(sc); + ldstart(sc, bp); splx(s); return; @@ -611,11 +613,15 @@ ldstrategy(struct buf *bp) } static void -ldstart(struct ld_softc *sc) +ldstart(struct ld_softc *sc, struct buf *bp) { - struct buf *bp; int error; + mutex_enter(&sc->sc_mutex); + + if (bp != NULL) + BUFQ_PUT(sc->sc_bufq, bp); + while (sc->sc_queuecnt < sc->sc_maxqueuecnt) { /* See if there is work to do. */ if ((bp = BUFQ_PEEK(sc->sc_bufq)) == NULL) @@ -648,10 +654,14 @@ ldstart(struct ld_softc *sc) bp->b_error = error; bp->b_flags |= B_ERROR; bp->b_resid = bp->b_bcount; + mutex_exit(&sc->sc_mutex); biodone(bp); + mutex_enter(&sc->sc_mutex); } } } + + mutex_exit(&sc->sc_mutex); } void @@ -670,13 +680,16 @@ lddone(struct ld_softc *sc, struct buf *bp) #endif biodone(bp); + mutex_enter(&sc->sc_mutex); if (--sc->sc_queuecnt <= sc->sc_maxqueuecnt) { if ((sc->sc_flags & LDF_DRAIN) != 0) { sc->sc_flags &= ~LDF_DRAIN; wakeup(&sc->sc_queuecnt); } - ldstart(sc); - } + mutex_exit(&sc->sc_mutex); + ldstart(sc, NULL); + } else + mutex_exit(&sc->sc_mutex); } static int diff --git a/sys/dev/ldvar.h b/sys/dev/ldvar.h index 25523e9dc94..44322e47fef 100644 --- a/sys/dev/ldvar.h +++ b/sys/dev/ldvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: ldvar.h,v 1.11 2005/12/11 12:20:53 christos Exp $ */ +/* $NetBSD: ldvar.h,v 1.12 2007/02/09 21:55:26 ad Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -39,10 +39,13 @@ #ifndef _DEV_LDVAR_H_ #define _DEV_LDVAR_H_ +#include <sys/mutex.h> + struct ld_softc { struct device sc_dv; struct disk sc_dk; struct bufq_state *sc_bufq; + kmutex_t sc_mutex; #if NRND > 0 rndsource_element_t sc_rnd_source; #endif diff --git a/sys/dev/lockstat.c b/sys/dev/lockstat.c index 6f591d645df..7b905bc8763 100644 --- a/sys/dev/lockstat.c +++ b/sys/dev/lockstat.c @@ -1,4 +1,4 @@ -/* $NetBSD: lockstat.c,v 1.5 2006/12/25 11:57:40 ad Exp $ */ +/* $NetBSD: lockstat.c,v 1.6 2007/02/09 21:55:26 ad Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -44,7 +44,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: lockstat.c,v 1.5 2006/12/25 11:57:40 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lockstat.c,v 1.6 2007/02/09 21:55:26 ad Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -241,22 +241,12 @@ lockstat_start(lsenable_t *le) lockstat_csstart = le->le_csstart; lockstat_csend = le->le_csend; lockstat_lockstart = le->le_lockstart; + lockstat_lockstart = le->le_lockstart; lockstat_lockend = le->le_lockend; -#ifdef notyet mb_memory(); -#else - lockstat_unlock(0); - (void)lockstat_lock(0); -#endif - getnanotime(&lockstat_stime); lockstat_enabled = le->le_mask; -#ifdef notyet mb_write(); -#else - lockstat_unlock(0); - (void)lockstat_lock(0); -#endif } /* @@ -369,7 +359,7 @@ lockstat_free(void) */ void lockstat_event(uintptr_t lock, uintptr_t callsite, u_int flags, u_int count, - uint64_t time) + uint64_t cycles) { lslist_t *ll; lscpu_t *lc; @@ -410,7 +400,7 @@ lockstat_event(uintptr_t lock, uintptr_t callsite, u_int flags, u_int count, LIST_INSERT_HEAD(ll, lb, lb_chain.list); } lb->lb_counts[event] += count; - lb->lb_times[event] += time; + lb->lb_times[event] += cycles; } else if ((lb = SLIST_FIRST(&lc->lc_free)) != NULL) { /* * Pinch a new buffer and fill it out. @@ -421,7 +411,7 @@ lockstat_event(uintptr_t lock, uintptr_t callsite, u_int flags, u_int count, lb->lb_lock = lock; lb->lb_callsite = callsite; lb->lb_counts[event] = count; - lb->lb_times[event] = time; + lb->lb_times[event] = cycles; } else { /* * We didn't find a buffer and there were none free. diff --git a/sys/dev/lockstat.h b/sys/dev/lockstat.h index 7caee54194e..ad316fbf0f3 100644 --- a/sys/dev/lockstat.h +++ b/sys/dev/lockstat.h @@ -1,4 +1,4 @@ -/* $NetBSD: lockstat.h,v 1.3 2007/01/29 01:52:45 hubertf Exp $ */ +/* $NetBSD: lockstat.h,v 1.4 2007/02/09 21:55:26 ad Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -119,7 +119,8 @@ typedef struct lsdisable { #define LB_RWLOCK 0x00000300 #define LB_LOCKMGR 0x00000400 #define LB_KERNEL_LOCK 0x00000500 -#define LB_NLOCK 0x00000500 +#define LB_MISC 0x00000600 +#define LB_NLOCK 0x00000600 #define LB_LOCK_MASK 0x0000ff00 #define LB_LOCK_SHIFT 8 @@ -143,32 +144,37 @@ typedef struct lsbuf { #if defined(_KERNEL) && defined(__HAVE_CPU_COUNTER) && NLOCKSTAT > 0 -#define LOCKSTAT_EVENT(lock, type, count, time) \ +#define LOCKSTAT_EVENT(flag, lock, type, count, time) \ do { \ - if (__predict_false(lockstat_enabled)) \ + if (__predict_false(flag)) \ lockstat_event((uintptr_t)(lock), \ (uintptr_t)__builtin_return_address(0), \ (type), (count), (time)); \ } while (/* CONSTCOND */ 0); -#define LOCKSTAT_EVENT_RA(lock, type, count, time, ra) \ +#define LOCKSTAT_EVENT_RA(flag, lock, type, count, time, ra) \ do { \ - if (__predict_false(lockstat_enabled)) \ + if (__predict_false(flag)) \ lockstat_event((uintptr_t)(lock), (uintptr_t)ra, \ (type), (count), (time)); \ } while (/* CONSTCOND */ 0); #define LOCKSTAT_TIMER(name) uint64_t name = 0 #define LOCKSTAT_COUNTER(name) uint64_t name = 0 +#define LOCKSTAT_FLAG(name) int name +#define LOCKSTAT_ENTER(name) name = lockstat_enabled +#define LOCKSTAT_EXIT(name) -#define LOCKSTAT_START_TIMER(name) \ +#define LOCKSTAT_START_TIMER(flag, name) \ do { \ - (name) -= cpu_counter(); \ + if (__predict_false(flag)) \ + (name) -= cpu_counter(); \ } while (/* CONSTCOND */ 0) -#define LOCKSTAT_STOP_TIMER(name) \ +#define LOCKSTAT_STOP_TIMER(flag, name) \ do { \ - (name) += cpu_counter(); \ + if (__predict_false(flag)) \ + (name) += cpu_counter(); \ } while (/* CONSTCOND */ 0) #define LOCKSTAT_COUNT(name, inc) \ @@ -182,13 +188,16 @@ extern volatile u_int lockstat_enabled; #else -#define LOCKSTAT_EVENT(lock, type, count, time) /* nothing */ -#define LOCKSTAT_EVENT_RA(lock, type, count, time, ra) /* nothing */ -#define LOCKSTAT_TIMER(void) /* nothing */ -#define LOCKSTAT_COUNTER(void) /* nothing */ -#define LOCKSTAT_START_TIMER(void) /* nothing */ -#define LOCKSTAT_STOP_TIMER(void) /* nothing */ -#define LOCKSTAT_COUNT(name, int) /* nothing */ +#define LOCKSTAT_FLAG(name) /* nothing */ +#define LOCKSTAT_ENTER(name) /* nothing */ +#define LOCKSTAT_EXIT(name) /* nothing */ +#define LOCKSTAT_EVENT(flag, lock, type, count, time) /* nothing */ +#define LOCKSTAT_EVENT_RA(flag, lock, type, count, time, ra) /* nothing */ +#define LOCKSTAT_TIMER(void) /* nothing */ +#define LOCKSTAT_COUNTER(void) /* nothing */ +#define LOCKSTAT_START_TIMER(flag, void) /* nothing */ +#define LOCKSTAT_STOP_TIMER(flag, void) /* nothing */ +#define LOCKSTAT_COUNT(name, int) /* nothing */ #endif diff --git a/sys/dev/midi.c b/sys/dev/midi.c index 04aaa0f9a9f..d829183b419 100644 --- a/sys/dev/midi.c +++ b/sys/dev/midi.c @@ -1,4 +1,4 @@ -/* $NetBSD: midi.c,v 1.50 2006/11/16 01:32:45 christos Exp $ */ +/* $NetBSD: midi.c,v 1.51 2007/02/09 21:55:26 ad Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: midi.c,v 1.50 2006/11/16 01:32:45 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: midi.c,v 1.51 2007/02/09 21:55:26 ad Exp $"); #include "midi.h" #include "sequencer.h" @@ -102,6 +102,8 @@ void midi_wakeup(int *); void midi_initbuf(struct midi_buffer *); void midi_xmt_asense(void *); void midi_rcv_asense(void *); +void midi_softintr_rd(void *); +void midi_softintr_wr(void *); int midiprobe(struct device *, struct cfdata *, void *); void midiattach(struct device *, struct device *, void *); @@ -211,6 +213,15 @@ mididetach(struct device *self, int flags) evcnt_detach(&sc->rcv.incompleteMessages); } + if (sc->sih_rd != NULL) { + softintr_disestablish(sc->sih_rd); + sc->sih_rd = NULL; + } + if (sc->sih_wr != NULL) { + softintr_disestablish(sc->sih_wr); + sc->sih_wr = NULL; + } + return (0); } @@ -230,7 +241,10 @@ midi_attach(struct midi_softc *sc, struct device *parent) sc->isopen = 0; sc->sc_dev = parent; - + + sc->sih_rd = softintr_establish(IPL_SOFTSERIAL, midi_softintr_rd, sc); + sc->sih_wr = softintr_establish(IPL_SOFTSERIAL, midi_softintr_wr, sc); + s = splaudio(); simple_lock(&hwif_register_lock); hwif_softc = sc; @@ -648,6 +662,36 @@ protocol_violation: } void +midi_softintr_rd(void *cookie) +{ + struct midi_softc *sc = cookie; + struct proc *p; + + if (sc->async != NULL) { + mutex_enter(&proclist_mutex); + if ((p = sc->async) != NULL) + psignal(p, SIGIO); + mutex_exit(&proclist_mutex); + } + selnotify(&sc->rsel, 0); /* filter will spin if locked */ +} + +void +midi_softintr_wr(void *cookie) +{ + struct midi_softc *sc = cookie; + struct proc *p; + + if (sc->async != NULL) { + mutex_enter(&proclist_mutex); + if ((p = sc->async) != NULL) + psignal(p, SIGIO); + mutex_exit(&proclist_mutex); + } + selnotify(&sc->wsel, 0); /* filter will spin if locked */ +} + +void midi_in(void *addr, int data) { struct midi_softc *sc = addr; @@ -738,10 +782,8 @@ sxp_again: MIDI_BUF_PRODUCER_WBACK(mb,buf); MIDI_BUF_PRODUCER_WBACK(mb,idx); midi_wakeup(&sc->rchan); - if (sc->async) - psignal(sc->async, SIGIO); MIDI_IN_UNLOCK(sc,s); - selnotify(&sc->rsel, 0); /* filter will spin if locked */ + softintr_schedule(sc->sih_rd); break; default: /* don't #ifdef this away, gcc will say FST_HUH not handled */ printf("midi_in: midi_fst returned %d?!\n", got); @@ -984,10 +1026,8 @@ midi_rcv_asense(void *arg) sc->rcv_quiescent = 0; sc->rcv_expect_asense = 0; midi_wakeup(&sc->rchan); - if (sc->async) - psignal(sc->async, SIGIO); MIDI_IN_UNLOCK(sc,s); - selnotify(&sc->rsel, 0); /* filter will spin if locked */ + softintr_schedule(sc->sih_rd); return; } @@ -1264,10 +1304,8 @@ midi_intr_out(struct midi_softc *sc) callout_schedule(&sc->xmt_asense_co, MIDI_XMT_ASENSE_PERIOD); } midi_wakeup(&sc->wchan); - if ( sc->async ) - psignal(sc->async, SIGIO); MIDI_OUT_UNLOCK(sc,s); - selnotify(&sc->wsel, 0); /* filter will spin if locked */ + softintr_schedule(sc->sih_wr); #if defined(AUDIO_DEBUG) || defined(DIAGNOSTIC) if ( error ) @@ -1440,7 +1478,7 @@ midiwrite(dev_t dev, struct uio *uio, int ioflag) goto locked_exit; } if ( pollout ) { - preempt(0); /* see midi_poll_output */ + preempt(); /* see midi_poll_output */ pollout = 0; } else error = midi_sleep(&sc->wchan, "mid wr", diff --git a/sys/dev/midivar.h b/sys/dev/midivar.h index 86583fc358e..3e456d023d9 100644 --- a/sys/dev/midivar.h +++ b/sys/dev/midivar.h @@ -1,4 +1,4 @@ -/* $NetBSD: midivar.h,v 1.12 2006/06/30 13:56:25 chap Exp $ */ +/* $NetBSD: midivar.h,v 1.13 2007/02/09 21:55:26 ad Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -230,6 +230,8 @@ struct midi_softc { struct selinfo wsel; /* write selector */ struct selinfo rsel; /* read selector */ struct proc *async; /* process who wants audio SIGIO */ + void *sih_rd; + void *sih_wr; struct callout xmt_asense_co; struct callout rcv_asense_co; diff --git a/sys/dev/pci/acardide.c b/sys/dev/pci/acardide.c index 92b4897cde6..5e734abef7a 100644 --- a/sys/dev/pci/acardide.c +++ b/sys/dev/pci/acardide.c @@ -1,4 +1,4 @@ -/* $NetBSD: acardide.c,v 1.20 2006/11/16 01:33:08 christos Exp $ */ +/* $NetBSD: acardide.c,v 1.21 2007/02/09 21:55:27 ad Exp $ */ /* * Copyright (c) 2001 Izumi Tsutsui. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: acardide.c,v 1.20 2006/11/16 01:33:08 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acardide.c,v 1.21 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -132,10 +132,10 @@ acard_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) PCIIDE_INTERFACE_PCI(0) | PCIIDE_INTERFACE_PCI(1); } - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); pciide_mapreg_dma(sc, pa); - aprint_normal("\n"); + aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_DATA32; if (sc->sc_dma_ok) { diff --git a/sys/dev/pci/aceride.c b/sys/dev/pci/aceride.c index d34f2a60884..c00a0baf115 100644 --- a/sys/dev/pci/aceride.c +++ b/sys/dev/pci/aceride.c @@ -1,4 +1,4 @@ -/* $NetBSD: aceride.c,v 1.22 2006/11/27 16:56:38 christos Exp $ */ +/* $NetBSD: aceride.c,v 1.23 2007/02/09 21:55:27 ad Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: aceride.c,v 1.22 2006/11/27 16:56:38 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: aceride.c,v 1.23 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -125,10 +125,10 @@ acer_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); pciide_mapreg_dma(sc, pa); - aprint_normal("\n"); + aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_DATA32; if (sc->sc_dma_ok) { sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DMA; diff --git a/sys/dev/pci/artsata.c b/sys/dev/pci/artsata.c index 2128e36ff4f..1606a3293b4 100644 --- a/sys/dev/pci/artsata.c +++ b/sys/dev/pci/artsata.c @@ -1,4 +1,4 @@ -/* $NetBSD: artsata.c,v 1.14 2006/11/16 01:33:08 christos Exp $ */ +/* $NetBSD: artsata.c,v 1.15 2007/02/09 21:55:27 ad Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #include "opt_pciide.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: artsata.c,v 1.14 2006/11/16 01:33:08 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: artsata.c,v 1.15 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -261,7 +261,7 @@ artisea_mapreg_dma(struct pciide_softc *sc, struct pci_attach_args *pa) u_int32_t dma_ctl; u_int32_t cacheline_len; - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); sc->sc_dma_ok = 1; @@ -273,7 +273,7 @@ artisea_mapreg_dma(struct pciide_softc *sc, struct pci_attach_args *pa) cacheline_len = PCI_CACHELINE(pci_conf_read (pa->pa_pc, pa->pa_tag, PCI_BHLC_REG)); if (cacheline_len == 0) { - aprint_normal(", but unused (cacheline size not set in PCI conf)\n"); + aprint_verbose(", but unused (cacheline size not set in PCI conf)\n"); sc->sc_dma_ok = 0; return; } @@ -295,7 +295,7 @@ artisea_mapreg_dma(struct pciide_softc *sc, struct pci_attach_args *pa) if (device_cfdata(&sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags & PCIIDE_OPTIONS_NODMA) { - aprint_normal( + aprint_verbose( ", but unused (forced off by config file)\n"); sc->sc_dma_ok = 0; return; @@ -318,12 +318,12 @@ artisea_mapreg_dma(struct pciide_softc *sc, struct pci_attach_args *pa) ARTISEA_DPA_PORT_BASE(chan) + ARTISEA_SUPDDDTPR, 4, &pc->dma_iohs[IDEDMA_TBL]) != 0) { sc->sc_dma_ok = 0; - aprint_normal(", but can't subregion registers\n"); + aprint_verbose(", but can't subregion registers\n"); return; } } - aprint_normal("\n"); + aprint_verbose("\n"); } static void @@ -412,17 +412,17 @@ artisea_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) return; } - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); #ifdef PCIIDE_I31244_DISABLEDMA if (sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_31244 && PCI_REVISION(pa->pa_class) == 0) { - aprint_normal(" but disabled due to rev. 0"); + aprint_verbose(" but disabled due to rev. 0"); sc->sc_dma_ok = 0; } else #endif pciide_mapreg_dma(sc, pa); - aprint_normal("\n"); + aprint_verbose("\n"); /* * XXX Configure LEDs to show activity. diff --git a/sys/dev/pci/bktr/bktr_core.c b/sys/dev/pci/bktr/bktr_core.c index b21f65be09a..b7bb88c8635 100644 --- a/sys/dev/pci/bktr/bktr_core.c +++ b/sys/dev/pci/bktr/bktr_core.c @@ -1,6 +1,6 @@ /* $SourceForge: bktr_core.c,v 1.6 2003/03/11 23:11:22 thomasklausner Exp $ */ -/* $NetBSD: bktr_core.c,v 1.40 2006/11/16 01:33:20 christos Exp $ */ +/* $NetBSD: bktr_core.c,v 1.41 2007/02/09 21:55:29 ad Exp $ */ /* $FreeBSD: src/sys/dev/bktr/bktr_core.c,v 1.114 2000/10/31 13:09:56 roger Exp$ */ /* @@ -98,7 +98,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: bktr_core.c,v 1.40 2006/11/16 01:33:20 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bktr_core.c,v 1.41 2007/02/09 21:55:29 ad Exp $"); #include "opt_bktr.h" /* Include any kernel config options */ @@ -917,10 +917,12 @@ common_bktr_intr(void *arg) */ if (bktr->proc && !(bktr->signal & METEOR_SIG_MODE_MASK)) { + mutex_enter(&proclist_mutex); PROC_LOCK(bktr->proc); psignal(bktr->proc, bktr->signal&(~METEOR_SIG_MODE_MASK)); PROC_UNLOCK(bktr->proc); + mutex_exit(&proclist_mutex); } /* diff --git a/sys/dev/pci/cmdide.c b/sys/dev/pci/cmdide.c index c711831e1de..499edfc4d56 100644 --- a/sys/dev/pci/cmdide.c +++ b/sys/dev/pci/cmdide.c @@ -1,4 +1,4 @@ -/* $NetBSD: cmdide.c,v 1.26 2006/11/24 22:04:25 wiz Exp $ */ +/* $NetBSD: cmdide.c,v 1.27 2007/02/09 21:55:27 ad Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cmdide.c,v 1.26 2006/11/24 22:04:25 wiz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cmdide.c,v 1.27 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -290,10 +290,10 @@ cmd0643_9_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) return; #endif - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); pciide_mapreg_dma(sc, pa); - aprint_normal("\n"); + aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_DATA32; if (sc->sc_dma_ok) { sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DMA; @@ -467,10 +467,10 @@ cmd680_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); pciide_mapreg_dma(sc, pa); - aprint_normal("\n"); + aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_DATA32; if (sc->sc_dma_ok) { sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DMA; diff --git a/sys/dev/pci/cypide.c b/sys/dev/pci/cypide.c index 21da770caa2..f54c4417f23 100644 --- a/sys/dev/pci/cypide.c +++ b/sys/dev/pci/cypide.c @@ -1,4 +1,4 @@ -/* $NetBSD: cypide.c,v 1.19 2006/11/16 01:33:08 christos Exp $ */ +/* $NetBSD: cypide.c,v 1.20 2007/02/09 21:55:27 ad Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cypide.c,v 1.19 2006/11/16 01:33:08 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cypide.c,v 1.20 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -117,15 +117,14 @@ cy693_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) return; } if (interface & PCIIDE_INTERFACE_BUS_MASTER_DMA) { - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present\n", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); pciide_mapreg_dma(sc, pa); } else { - aprint_normal("%s: hardware does not support DMA", + aprint_normal("%s: hardware does not support DMA\n", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); sc->sc_dma_ok = 0; } - aprint_normal("\n"); sc->sc_cy_handle = cy82c693_init(pa->pa_iot); if (sc->sc_cy_handle == NULL) { diff --git a/sys/dev/pci/ehci_pci.c b/sys/dev/pci/ehci_pci.c index 7b8449dd37a..a92e699da1e 100644 --- a/sys/dev/pci/ehci_pci.c +++ b/sys/dev/pci/ehci_pci.c @@ -1,4 +1,4 @@ -/* $NetBSD: ehci_pci.c,v 1.26 2006/11/16 01:33:08 christos Exp $ */ +/* $NetBSD: ehci_pci.c,v 1.27 2007/02/09 21:55:27 ad Exp $ */ /* * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.26 2006/11/16 01:33:08 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.27 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -162,7 +162,7 @@ ehci_pci_attach(struct device *parent, struct device *self, void *aux) case PCI_USBREV_1_0: case PCI_USBREV_1_1: sc->sc.sc_bus.usbrev = USBREV_UNKNOWN; - aprint_normal("%s: pre-2.0 USB rev\n", devname); + aprint_verbose("%s: pre-2.0 USB rev\n", devname); return; case PCI_USBREV_2_0: sc->sc.sc_bus.usbrev = USBREV_2_0; @@ -318,7 +318,7 @@ ehci_get_ownership(ehci_softc_t *sc, pci_chipset_tag_t pc, pcitag_t tag) pci_conf_write(pc, tag, addr + PCI_EHCI_USBLEGSUP, 0); pci_conf_write(pc, tag, addr + PCI_EHCI_USBLEGCTLSTS, 0); } else { - aprint_normal("%s: BIOS has given up ownership\n", devname); + aprint_verbose("%s: BIOS has given up ownership\n", devname); } } diff --git a/sys/dev/pci/geodeide.c b/sys/dev/pci/geodeide.c index 540f66477d6..484ebeb07e9 100644 --- a/sys/dev/pci/geodeide.c +++ b/sys/dev/pci/geodeide.c @@ -1,4 +1,4 @@ -/* $NetBSD: geodeide.c,v 1.13 2006/11/16 01:33:08 christos Exp $ */ +/* $NetBSD: geodeide.c,v 1.14 2007/02/09 21:55:27 ad Exp $ */ /* * Copyright (c) 2004 Manuel Bouyer. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: geodeide.c,v 1.13 2006/11/16 01:33:08 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: geodeide.c,v 1.14 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -115,10 +115,10 @@ geodeide_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); pciide_mapreg_dma(sc, pa); - aprint_normal("\n"); + aprint_verbose("\n"); if (sc->sc_dma_ok) { sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DMA | ATAC_CAP_UDMA; sc->sc_wdcdev.irqack = pciide_irqack; diff --git a/sys/dev/pci/hptide.c b/sys/dev/pci/hptide.c index 1f06f1eeb11..25aa182a16a 100644 --- a/sys/dev/pci/hptide.c +++ b/sys/dev/pci/hptide.c @@ -1,4 +1,4 @@ -/* $NetBSD: hptide.c,v 1.23 2006/11/16 01:33:08 christos Exp $ */ +/* $NetBSD: hptide.c,v 1.24 2007/02/09 21:55:27 ad Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hptide.c,v 1.23 2006/11/16 01:33:08 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hptide.c,v 1.24 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -174,10 +174,10 @@ hpt_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) interface |= PCIIDE_INTERFACE_PCI(1); } - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); pciide_mapreg_dma(sc, pa); - aprint_normal("\n"); + aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_DATA32; if (sc->sc_dma_ok) { sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DMA | ATAC_CAP_UDMA; diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c index 89f5f1ab1da..dab449f53c0 100644 --- a/sys/dev/pci/if_bge.c +++ b/sys/dev/pci/if_bge.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_bge.c,v 1.122 2006/11/26 06:09:09 tsutsui Exp $ */ +/* $NetBSD: if_bge.c,v 1.123 2007/02/09 21:55:27 ad Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -79,7 +79,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.122 2006/11/26 06:09:09 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.123 2007/02/09 21:55:27 ad Exp $"); #include "bpfilter.h" #include "vlan.h" @@ -1268,7 +1268,8 @@ bge_chipinit(struct bge_softc *sc) dma_rw_ctl = 0x76000000; /* XXX XXX XXX */; device_ctl = pci_conf_read(pa->pa_pc, pa->pa_tag, BGE_PCI_CONF_DEV_CTRL); - printf("%s: pcie mode=0x%x\n", sc->bge_dev.dv_xname, device_ctl); + aprint_debug("%s: pcie mode=0x%x\n", sc->bge_dev.dv_xname, + device_ctl); if ((device_ctl & 0x00e0) && 0) { /* @@ -2550,7 +2551,7 @@ bge_attach(device_t parent, device_t self, void *aux) if (sc->bge_quirks & BGE_QUIRK_5705_CORE) { sc->bge_tx_coal_ticks = (12 * 5); sc->bge_rx_max_coal_bds = (12 * 5); - aprint_error("%s: setting short Tx thresholds\n", + aprint_verbose("%s: setting short Tx thresholds\n", sc->bge_dev.dv_xname); } diff --git a/sys/dev/pci/iteide.c b/sys/dev/pci/iteide.c index 935be86005e..cc233c937bf 100644 --- a/sys/dev/pci/iteide.c +++ b/sys/dev/pci/iteide.c @@ -1,4 +1,4 @@ -/* $NetBSD: iteide.c,v 1.7 2006/11/16 01:33:09 christos Exp $ */ +/* $NetBSD: iteide.c,v 1.8 2007/02/09 21:55:27 ad Exp $ */ /* * Copyright (c) 2004 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: iteide.c,v 1.7 2006/11/16 01:33:09 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: iteide.c,v 1.8 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -114,10 +114,10 @@ ite_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); pciide_mapreg_dma(sc, pa); - aprint_normal("\n"); + aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_DATA32; diff --git a/sys/dev/pci/ixpide.c b/sys/dev/pci/ixpide.c index 8afb20c7227..94e17c2d8d5 100644 --- a/sys/dev/pci/ixpide.c +++ b/sys/dev/pci/ixpide.c @@ -1,4 +1,4 @@ -/* $NetBSD: ixpide.c,v 1.8 2006/11/16 01:33:09 christos Exp $ */ +/* $NetBSD: ixpide.c,v 1.9 2007/02/09 21:55:27 ad Exp $ */ /* * Copyright (c) 2004 The NetBSD Foundation. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ixpide.c,v 1.8 2006/11/16 01:33:09 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixpide.c,v 1.9 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -106,10 +106,10 @@ ixp_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); pciide_mapreg_dma(sc, pa); - aprint_normal("\n"); + aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_DATA32; if (sc->sc_dma_ok) { diff --git a/sys/dev/pci/optiide.c b/sys/dev/pci/optiide.c index a619dca6585..8178ebd731f 100644 --- a/sys/dev/pci/optiide.c +++ b/sys/dev/pci/optiide.c @@ -1,4 +1,4 @@ -/* $NetBSD: optiide.c,v 1.14 2006/11/16 01:33:09 christos Exp $ */ +/* $NetBSD: optiide.c,v 1.15 2007/02/09 21:55:27 ad Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: optiide.c,v 1.14 2006/11/16 01:33:09 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: optiide.c,v 1.15 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -118,7 +118,7 @@ opti_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); /* @@ -130,12 +130,12 @@ opti_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) * issues too... */ if (PCI_REVISION(pa->pa_class) <= 0x12) { - aprint_normal(" but disabled due to chip rev. <= 0x12"); + aprint_verbose(" but disabled due to chip rev. <= 0x12"); sc->sc_dma_ok = 0; } else pciide_mapreg_dma(sc, pa); - aprint_normal("\n"); + aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA32 | ATAC_CAP_DATA16; sc->sc_wdcdev.sc_atac.atac_pio_cap = 4; diff --git a/sys/dev/pci/pciide_common.c b/sys/dev/pci/pciide_common.c index b1dedf16f59..feaf41f04ae 100644 --- a/sys/dev/pci/pciide_common.c +++ b/sys/dev/pci/pciide_common.c @@ -1,4 +1,4 @@ -/* $NetBSD: pciide_common.c,v 1.35 2006/11/16 01:33:10 christos Exp $ */ +/* $NetBSD: pciide_common.c,v 1.36 2007/02/09 21:55:27 ad Exp $ */ /* @@ -76,7 +76,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.35 2006/11/16 01:33:10 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.36 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/malloc.h> @@ -382,14 +382,14 @@ pciide_mapreg_dma(sc, pa) PCIIDE_REG_BUS_MASTER_DMA, PCI_MAPREG_TYPE_IO, &addr, NULL, NULL) == 0); if (sc->sc_dma_ok == 0) { - aprint_normal( + aprint_verbose( ", but unused (couldn't query registers)"); break; } if ((sc->sc_pp->ide_flags & IDE_16BIT_IOSPACE) && addr >= 0x10000) { sc->sc_dma_ok = 0; - aprint_normal( + aprint_verbose( ", but unused (registers at unsafe address " "%#lx)", (unsigned long)addr); break; @@ -402,7 +402,7 @@ pciide_mapreg_dma(sc, pa) &sc->sc_dma_iot, &sc->sc_dma_ioh, NULL, NULL) == 0); sc->sc_dmat = pa->pa_dmat; if (sc->sc_dma_ok == 0) { - aprint_normal(", but unused (couldn't map registers)"); + aprint_verbose(", but unused (couldn't map registers)"); } else { sc->sc_wdcdev.dma_arg = sc; sc->sc_wdcdev.dma_init = pciide_dma_init; @@ -412,7 +412,7 @@ pciide_mapreg_dma(sc, pa) if (device_cfdata(&sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags & PCIIDE_OPTIONS_NODMA) { - aprint_normal( + aprint_verbose( ", but unused (forced off by config file)"); sc->sc_dma_ok = 0; } @@ -420,7 +420,7 @@ pciide_mapreg_dma(sc, pa) default: sc->sc_dma_ok = 0; - aprint_normal( + aprint_verbose( ", but unsupported register maptype (0x%x)", maptype); } @@ -442,7 +442,7 @@ pciide_mapreg_dma(sc, pa) IDEDMA_SCH_OFFSET * chan + reg, size, &pc->dma_iohs[reg]) != 0) { sc->sc_dma_ok = 0; - aprint_normal(", but can't subregion offset %d " + aprint_verbose(", but can't subregion offset %d " "size %lu", reg, (u_long)size); return; } @@ -802,7 +802,7 @@ pciide_chansetup(sc, channel, interface) return 0; } cp->ata_channel.ch_ndrive = 2; - aprint_normal("%s: %s channel %s to %s mode\n", + aprint_verbose("%s: %s channel %s to %s mode\n", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name, (interface & PCIIDE_INTERFACE_SETTABLE(channel)) ? "configured" : "wired", @@ -881,31 +881,31 @@ default_chip_map(sc, pa) if (interface & PCIIDE_INTERFACE_BUS_MASTER_DMA) { #if NATA_DMA - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); if (sc->sc_pp == &default_product_desc && (device_cfdata(&sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags & PCIIDE_OPTIONS_DMA) == 0) { - aprint_normal(", but unused (no driver support)"); + aprint_verbose(", but unused (no driver support)"); sc->sc_dma_ok = 0; } else { pciide_mapreg_dma(sc, pa); if (sc->sc_dma_ok != 0) - aprint_normal(", used without full driver " + aprint_verbose(", used without full driver " "support"); } #else - aprint_normal("%s: bus-master DMA support present, but unused (no driver support)", + aprint_verbose("%s: bus-master DMA support present, but unused (no driver support)", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); #endif /* NATA_DMA */ } else { - aprint_normal("%s: hardware does not support DMA", + aprint_verbose("%s: hardware does not support DMA", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); #if NATA_DMA sc->sc_dma_ok = 0; #endif } - aprint_normal("\n"); + aprint_verbose("\n"); #if NATA_DMA if (sc->sc_dma_ok) { sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DMA; diff --git a/sys/dev/pci/pdcide.c b/sys/dev/pci/pdcide.c index 8245b63b459..4899b21a369 100644 --- a/sys/dev/pci/pdcide.c +++ b/sys/dev/pci/pdcide.c @@ -1,4 +1,4 @@ -/* $NetBSD: pdcide.c,v 1.24 2006/11/16 01:33:10 christos Exp $ */ +/* $NetBSD: pdcide.c,v 1.25 2007/02/09 21:55:27 ad Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pdcide.c,v 1.24 2006/11/16 01:33:10 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pdcide.c,v 1.25 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -211,10 +211,10 @@ pdc202xx_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (st & PDC2xx_STATE_NATIVE) interface |= PCIIDE_INTERFACE_PCI(0) | PCIIDE_INTERFACE_PCI(1); - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); pciide_mapreg_dma(sc, pa); - aprint_normal("\n"); + aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_DATA32; if (sc->sc_dma_ok) { sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DMA | ATAC_CAP_UDMA; diff --git a/sys/dev/pci/pdcsata.c b/sys/dev/pci/pdcsata.c index 98b5227d1a9..aee4f43fb08 100644 --- a/sys/dev/pci/pdcsata.c +++ b/sys/dev/pci/pdcsata.c @@ -1,4 +1,4 @@ -/* $NetBSD: pdcsata.c,v 1.14 2006/11/16 01:33:10 christos Exp $ */ +/* $NetBSD: pdcsata.c,v 1.15 2007/02/09 21:55:27 ad Exp $ */ /* * Copyright (c) 2004, Manuel Bouyer. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pdcsata.c,v 1.14 2006/11/16 01:33:10 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pdcsata.c,v 1.15 2007/02/09 21:55:27 ad Exp $"); #include <sys/types.h> #include <sys/malloc.h> @@ -281,7 +281,7 @@ pdcsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) return; } - aprint_normal("%s: bus-master DMA support present\n", + aprint_verbose("%s: bus-master DMA support present\n", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16; if (sc->sc_dma_ok) { diff --git a/sys/dev/pci/piixide.c b/sys/dev/pci/piixide.c index 8fc3001aa6c..c0372d484ca 100644 --- a/sys/dev/pci/piixide.c +++ b/sys/dev/pci/piixide.c @@ -1,4 +1,4 @@ -/* $NetBSD: piixide.c,v 1.35 2006/12/01 10:31:30 cube Exp $ */ +/* $NetBSD: piixide.c,v 1.36 2007/02/09 21:55:27 ad Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: piixide.c,v 1.35 2006/12/01 10:31:30 cube Exp $"); +__KERNEL_RCSID(0, "$NetBSD: piixide.c,v 1.36 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -301,10 +301,10 @@ piix_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); pciide_mapreg_dma(sc, pa); - aprint_normal("\n"); + aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DATA16 | ATAC_CAP_DATA32; if (sc->sc_dma_ok) { sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DMA; @@ -797,10 +797,10 @@ piixsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); pciide_mapreg_dma(sc, pa); - aprint_normal("\n"); + aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DATA16 | ATAC_CAP_DATA32; sc->sc_wdcdev.sc_atac.atac_pio_cap = 4; diff --git a/sys/dev/pci/radeonfb.c b/sys/dev/pci/radeonfb.c index 3b9f2d45109..ed4b4e43a8f 100644 --- a/sys/dev/pci/radeonfb.c +++ b/sys/dev/pci/radeonfb.c @@ -1,4 +1,4 @@ -/* $NetBSD: radeonfb.c,v 1.10 2007/02/09 21:12:00 macallan Exp $ */ +/* $NetBSD: radeonfb.c,v 1.11 2007/02/09 21:55:27 ad Exp $ */ /*- * Copyright (c) 2006 Itronix Inc. @@ -29,7 +29,7 @@ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + */ /* * ATI Technologies Inc. ("ATI") has not assisted in the creation of, and @@ -70,7 +70,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.10 2007/02/09 21:12:00 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.11 2007/02/09 21:55:27 ad Exp $"); #define RADEONFB_DEFAULT_DEPTH 32 @@ -171,7 +171,7 @@ static struct videomode *radeonfb_best_refresh(struct videomode *, struct videomode *); static void radeonfb_pickres(struct radeonfb_display *, uint16_t *, uint16_t *, int); -static const struct videomode *radeonfb_port_mode(struct radeonfb_softc *, +static const struct videomode *radeonfb_port_mode(struct radeonfb_softc *, struct radeonfb_port *, int, int); @@ -193,6 +193,7 @@ int radeon_debug = 1; #ifndef RADEON_DEFAULT_MODE /* any reasonably modern display should handle this */ #define RADEON_DEFAULT_MODE "1024x768x60" +//#define RADEON_DEFAULT_MODE "1280x1024x60" #endif const char *radeonfb_default_mode = RADEON_DEFAULT_MODE; @@ -234,7 +235,7 @@ static struct { uint16_t devid; uint16_t family; uint16_t flags; -} radeonfb_devices[] = +} radeonfb_devices[] = { /* R100 family */ { PCI_PRODUCT_ATI_RADEON_R100_QD, RADEON_R100, 0 }, @@ -443,8 +444,6 @@ radeonfb_attach(struct device *parent, struct device *dev, void *aux) aprint_naive("\n"); aprint_normal(": %s\n", sc->sc_devinfo); - DPRINTF((prop_dictionary_externalize(device_properties(dev)))); - KASSERT(radeonfb_devices[i].devid != 0); sc->sc_pt = pa->pa_tag; sc->sc_pc = pa->pa_pc; @@ -492,22 +491,6 @@ radeonfb_attach(struct device *parent, struct device *dev, void *aux) break; } - if ((sc->sc_family == RADEON_RV200) || - (sc->sc_family == RADEON_RV250) || - (sc->sc_family == RADEON_RV280) || - (sc->sc_family == RADEON_RV350)) { - int inverted = 0; - /* backlight level is linear */ - DPRINTF(("found RV* chip, backlight is supposedly linear\n")); - prop_dictionary_get_bool(device_properties(&sc->sc_dev), - "backlight_level_reverted", &inverted); - if (inverted) { - DPRINTF(("nope, it's inverted\n")); - sc->sc_flags |= RFB_INV_BLIGHT; - } - } else - sc->sc_flags |= RFB_INV_BLIGHT; - /* * XXX: to support true multihead, this must change. */ @@ -643,7 +626,7 @@ radeonfb_attach(struct device *parent, struct device *dev, void *aux) v |= RADEON_DAC_MASK_ALL | RADEON_DAC_8BIT_EN; PUT32(sc, RADEON_DAC_CNTL, v); PRINTREG(RADEON_DAC_CNTL); - + /* XXX: this may need more investigation */ PUT32(sc, RADEON_TV_DAC_CNTL, 0x00280203); PRINTREG(RADEON_TV_DAC_CNTL); @@ -704,7 +687,7 @@ radeonfb_attach(struct device *parent, struct device *dev, void *aux) struct rasops_info *ri; long defattr; struct wsemuldisplaydev_attach_args aa; - + /* * Figure out how many "displays" (desktops) we are going to * support. If more than one, then each CRTC gets its own @@ -887,7 +870,7 @@ radeonfb_attach(struct device *parent, struct device *dev, void *aux) config_found(&sc->sc_dev, &aa, wsemuldisplaydevprint); radeonfb_blank(dp, 0); - + /* Initialise delayed lvds operations for backlight. */ callout_init(&dp->rd_bl_lvds_co); callout_setfunc(&dp->rd_bl_lvds_co, @@ -929,8 +912,8 @@ radeonfb_ioctl(void *v, void *vs, if (vd->active != NULL) { struct wsdisplay_fbinfo *fb; fb = (struct wsdisplay_fbinfo *)d; - fb->width = dp->rd_virtx; - fb->height = dp->rd_virty; + fb->width = dp->rd_virtx; + fb->height = dp->rd_virty; fb->depth = dp->rd_bpp; fb->cmsize = 256; return 0; @@ -955,7 +938,7 @@ radeonfb_ioctl(void *v, void *vs, (struct wsdisplay_cmap *)d); #endif return EINVAL; - + case WSDISPLAYIO_PUTCMAP: #if 0 if (dp->rd_bpp == 8) @@ -963,7 +946,7 @@ radeonfb_ioctl(void *v, void *vs, (struct wsdisplay_cmap *)d); #endif return EINVAL; - + case WSDISPLAYIO_LINEBYTES: *(unsigned *)d = dp->rd_stride; return 0; @@ -1079,25 +1062,25 @@ radeonfb_mmap(void *v, void *vs, off_t offset, int prot) } } - if ((offset >= sc->sc_regaddr) && + if ((offset >= sc->sc_regaddr) && (offset < sc->sc_regaddr + sc->sc_regsz)) { - return bus_space_mmap(sc->sc_regt, offset, 0, prot, + return bus_space_mmap(sc->sc_regt, offset, 0, prot, BUS_SPACE_MAP_LINEAR); } - if ((offset >= sc->sc_memaddr) && + if ((offset >= sc->sc_memaddr) && (offset < sc->sc_memaddr + sc->sc_memsz)) { - return bus_space_mmap(sc->sc_memt, offset, 0, prot, + return bus_space_mmap(sc->sc_memt, offset, 0, prot, BUS_SPACE_MAP_LINEAR); } #ifdef macppc /* allow mapping of IO space */ if ((offset >= 0xf2000000) && (offset < 0xf2800000)) { - pa = bus_space_mmap(sc->sc_iot, offset-0xf2000000, 0, prot, - BUS_SPACE_MAP_LINEAR); + pa = bus_space_mmap(sc->sc_iot, offset-0xf2000000, 0, prot, + BUS_SPACE_MAP_LINEAR); return pa; - } + } #endif /* macppc */ #endif /* RADEONFB_MMAP_BARS */ @@ -1339,7 +1322,7 @@ radeonfb_getclocks(struct radeonfb_softc *sc) */ if (refdiv < 2) refdiv = 12; - + } else { /* Legacy BIOS */ ptr = GETBIOS16(sc, 0x48); @@ -1599,7 +1582,7 @@ radeonfb_gettmds(struct radeonfb_softc *sc) ptr = GETBIOS16(sc, 0x48); ptr = GETBIOS16(sc, ptr + 0x34); DPRINTF(("DFP table revision %d\n", GETBIOS8(sc, ptr))); - if (GETBIOS8(sc, ptr) == 3) { + if (GETBIOS8(sc, ptr) == 3) { /* revision three table */ n = GETBIOS8(sc, ptr + 5) + 1; n = min(n, 4); @@ -1704,7 +1687,7 @@ radeonfb_program_vclk(struct radeonfb_softc *sc, int dotclock, int crtc) PATCHPLL(sc, RADEON_VCLK_ECP_CNTL, RADEON_VCLK_SRC_SEL_CPUCLK, ~RADEON_VCLK_SRC_SEL_MASK); - + /* put vclk into reset, use atomic updates */ SETPLL(sc, RADEON_PPLL_CNTL, RADEON_PPLL_REFCLK_SEL | @@ -1721,7 +1704,7 @@ radeonfb_program_vclk(struct radeonfb_softc *sc, int dotclock, int crtc) PATCH32(sc, RADEON_CLOCK_CNTL_INDEX, 0, ~RADEON_PLL_DIV_SEL); #endif - + /* XXX: R300 family -- program divider differently? */ /* program reference divider */ @@ -1935,7 +1918,7 @@ radeonfb_setcrtc(struct radeonfb_display *dp, int index) if (crtc == 1) v |= RADEON_CRTC2_VSYNC_TRISTAT; } - + PUT32(sc, gencntl, v); DPRINTF(("CRTC%s_GEN_CNTL = %08x\n", crtc ? "2" : "", v)); @@ -2025,7 +2008,7 @@ radeonfb_setcrtc(struct radeonfb_display *dp, int index) CLR32(sc, RADEON_CRTC2_GEN_CNTL, RADEON_CRTC2_VSYNC_DIS | RADEON_CRTC2_HSYNC_DIS | - RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_DISP_REQ_EN_B); + RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_DISP_REQ_EN_B); PRINTREG(RADEON_CRTC2_GEN_CNTL); break; } @@ -2067,7 +2050,7 @@ radeonfb_blank(struct radeonfb_display *dp, int blank) fpreg = RADEON_FP_GEN_CNTL; fpval = RADEON_FP_FPON; } - + if (blank) { SET32(sc, reg, mask); CLR32(sc, fpreg, fpval); @@ -2158,7 +2141,7 @@ radeonfb_set_fbloc(struct radeonfb_softc *sc) if (HAS_CRTC2(sc)) { gen2 = GET32(sc, RADEON_CRTC2_GEN_CNTL); - PUT32(sc, RADEON_CRTC2_GEN_CNTL, + PUT32(sc, RADEON_CRTC2_GEN_CNTL, gen2 | RADEON_CRTC2_DISP_REQ_EN_B); } @@ -2413,10 +2396,10 @@ radeonfb_cursor(void *cookie, int on, int row, int col) struct vcons_screen *scr = ri->ri_hw; struct radeonfb_display *dp = scr->scr_cookie; int x, y, wi, he; - + wi = ri->ri_font->fontwidth; he = ri->ri_font->fontheight; - + if (dp->rd_wsmode == WSDISPLAYIO_MODE_EMUL) { x = ri->ri_ccol * wi + ri->ri_xorigin; y = ri->ri_crow * he + ri->ri_yorigin; @@ -2465,21 +2448,21 @@ radeonfb_setup_mono(struct radeonfb_display *dp, int xd, int yd, int width, uint32_t gmc; uint32_t padded_width = (width+7) & 0xfff8; uint32_t topleft, bottomright; - + gmc = dp->rd_format << RADEON_GMC_DST_DATATYPE_SHIFT; if (width != padded_width) { radeonfb_wait_fifo(sc, 2); topleft = ((yd << 16) & 0x1fff0000) | (xd & 0x1fff); - bottomright = (((yd + height) << 16) & 0x1fff0000) | + bottomright = (((yd + height) << 16) & 0x1fff0000) | ((xd + width) & 0x1fff); PUT32(sc, RADEON_SC_TOP_LEFT, topleft); PUT32(sc, RADEON_SC_BOTTOM_RIGHT, bottomright); } radeonfb_wait_fifo(sc, 5); - + PUT32(sc, RADEON_DP_GUI_MASTER_CNTL, RADEON_GMC_BRUSH_NONE | RADEON_GMC_SRC_DATATYPE_MONO_FG_BG | @@ -2496,7 +2479,7 @@ radeonfb_setup_mono(struct radeonfb_display *dp, int xd, int yd, int width, PUT32(sc, RADEON_DST_X_Y, (xd << 16) | yd); PUT32(sc, RADEON_DST_WIDTH_HEIGHT, (padded_width << 16) | height); - + } static void @@ -2506,7 +2489,7 @@ radeonfb_feed_bytes(struct radeonfb_display *dp, int count, uint8_t *data) int i; uint32_t latch = 0; int shift = 0; - + for (i = 0; i < count; i++) { latch |= (data[i] << shift); if (shift == 24) { @@ -2580,7 +2563,7 @@ radeonfb_bitblt(struct radeonfb_display *dp, int srcx, int srcy, } gmc = dp->rd_format << RADEON_GMC_DST_DATATYPE_SHIFT; - + radeonfb_wait_fifo(sc, 6); PUT32(sc, RADEON_DP_GUI_MASTER_CNTL, @@ -2834,7 +2817,7 @@ radeonfb_set_cursor(struct radeonfb_display *dp, struct wsdisplay_cursor *wc) if (flags & WSDISPLAY_CURSOR_DOCMAP) { index = wc->cmap.index; count = wc->cmap.count; - + if (index >= 2 || (index + count) > 2) return EINVAL; @@ -3080,7 +3063,7 @@ radeonfb_cursor_visible(struct radeonfb_display *dp) gencntl = RADEON_CRTC_GEN_CNTL; bit = RADEON_CRTC_CUR_EN; } - + if (dp->rd_cursor.rc_visible) SET32(dp->rd_softc, gencntl, bit); else @@ -3161,7 +3144,7 @@ radeonfb_port_mode(struct radeonfb_softc *sc, struct radeonfb_port *rp, /* fallback to safe mode */ return radeonfb_modelookup(sc->sc_defaultmode); } - + /* always choose the preferred mode first! */ if (ep->edid_preferred_mode) { @@ -3347,16 +3330,10 @@ radeonfb_pickres(struct radeonfb_display *dp, uint16_t *x, uint16_t *y, } } -/* - * backlight levels are linear on: - * - RV200, RV250, RV280, RV350 - * - but NOT on PowerBook4,3 6,3 6,5 - * according to Linux' radeonfb - */ /* Get the current backlight level for the display. */ -static int +static int radeonfb_get_backlight(struct radeonfb_display *dp) { int s; @@ -3368,21 +3345,22 @@ radeonfb_get_backlight(struct radeonfb_display *dp) level &= RADEON_LVDS_BL_MOD_LEV_MASK; level >>= RADEON_LVDS_BL_MOD_LEV_SHIFT; - /* - * On some chips, we should negate the backlight level. - * XXX Find out on which chips. + /* + * On some chips, we should negate the backlight level. + * XXX Find out on which chips. */ - if (dp->rd_softc->sc_flags & RFB_INV_BLIGHT) - level = RADEONFB_BACKLIGHT_MAX - level; +#ifdef RADEONFB_BACKLIGHT_NEGATED + level = RADEONFB_BACKLIGHT_MAX - level; +#endif /* RADEONFB_BACKLIGHT_NEGATED */ splx(s); return level; -} +} /* Set the backlight to the given level for the display. */ -static int +static int radeonfb_set_backlight(struct radeonfb_display *dp, int level) { struct radeonfb_softc *sc; @@ -3390,7 +3368,7 @@ radeonfb_set_backlight(struct radeonfb_display *dp, int level) uint32_t lvds; s = spltty(); - + if (level < 0) level = 0; else if (level >= RADEONFB_BACKLIGHT_MAX) @@ -3399,23 +3377,24 @@ radeonfb_set_backlight(struct radeonfb_display *dp, int level) sc = dp->rd_softc; /* On some chips, we should negate the backlight level. */ - if (dp->rd_softc->sc_flags & RFB_INV_BLIGHT) { - rlevel = RADEONFB_BACKLIGHT_MAX - level; - } else - rlevel = level; +#ifdef RADEONFB_BACKLIGHT_NEGATED + rlevel = RADEONFB_BACKLIGHT_MAX - level; +#else + rlevel = level; +#endif /* RADEONFB_BACKLIGHT_NEGATED */ callout_stop(&dp->rd_bl_lvds_co); radeonfb_engine_idle(sc); - /* + /* * Turn off the display if the backlight is set to 0, since the - * display is useless without backlight anyway. + * display is useless without backlight anyway. */ if (level == 0) radeonfb_blank(dp, 1); else if (radeonfb_get_backlight(dp) == 0) radeonfb_blank(dp, 0); - + lvds = radeonfb_get32(sc, RADEON_LVDS_GEN_CNTL); lvds &= ~RADEON_LVDS_DISPLAY_DIS; if (!(lvds & RADEON_LVDS_BLON) || !(lvds & RADEON_LVDS_ON)) { @@ -3431,19 +3410,19 @@ radeonfb_set_backlight(struct radeonfb_display *dp, int level) lvds |= rlevel << RADEON_LVDS_BL_MOD_LEV_SHIFT; radeonfb_put32(sc, RADEON_LVDS_GEN_CNTL, lvds); } - + dp->rd_bl_lvds_val &= ~RADEON_LVDS_STATE_MASK; dp->rd_bl_lvds_val |= lvds & RADEON_LVDS_STATE_MASK; /* XXX What is the correct delay? */ - callout_schedule(&dp->rd_bl_lvds_co, 200 * hz); + callout_schedule(&dp->rd_bl_lvds_co, 200 * hz); splx(s); return 0; } -/* - * Callout function for delayed operations on the LVDS_GEN_CNTL register. +/* + * Callout function for delayed operations on the LVDS_GEN_CNTL register. * Set the delayed bits in the register, and clear the stored delayed * value. */ @@ -3455,7 +3434,7 @@ static void radeonfb_lvds_callout(void *arg) s = splhigh(); - radeonfb_mask32(dp->rd_softc, RADEON_LVDS_GEN_CNTL, ~0, + radeonfb_mask32(dp->rd_softc, RADEON_LVDS_GEN_CNTL, ~0, dp->rd_bl_lvds_val); dp->rd_bl_lvds_val = 0; diff --git a/sys/dev/pci/radeonfbvar.h b/sys/dev/pci/radeonfbvar.h index a66f0e8a041..77b1a3037b8 100644 --- a/sys/dev/pci/radeonfbvar.h +++ b/sys/dev/pci/radeonfbvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: radeonfbvar.h,v 1.4 2007/02/09 21:12:00 macallan Exp $ */ +/* $NetBSD: radeonfbvar.h,v 1.5 2007/02/09 21:55:27 ad Exp $ */ /*- * Copyright (c) 2006 Itronix Inc. @@ -29,7 +29,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - */ + */ /* * ATI Technologies Inc. ("ATI") has not assisted in the creation of, and @@ -303,7 +303,6 @@ struct radeonfb_softc { #define RFB_R300 (1 << 5) /* R300 variants -- newer parts */ #define RFB_RV100 (1 << 6) /* RV100 variants -- previous gen */ #define RFB_ATOM (1 << 7) /* ATOM bios */ -#define RFB_INV_BLIGHT (1 << 8) /* backlight level inverted */ #define IS_MOBILITY(sc) ((sc)->sc_flags & RFB_MOB) #define HAS_CRTC2(sc) (((sc)->sc_flags & RFB_NCRTC2) == 0) diff --git a/sys/dev/pci/rccide.c b/sys/dev/pci/rccide.c index 0baf7d2700d..382b1173622 100644 --- a/sys/dev/pci/rccide.c +++ b/sys/dev/pci/rccide.c @@ -1,4 +1,4 @@ -/* $NetBSD: rccide.c,v 1.15 2006/11/16 01:33:10 christos Exp $ */ +/* $NetBSD: rccide.c,v 1.16 2007/02/09 21:55:27 ad Exp $ */ /* * Copyright (c) 2003 By Noon Software, Inc. All rights reserved. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rccide.c,v 1.15 2006/11/16 01:33:10 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rccide.c,v 1.16 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -115,10 +115,10 @@ serverworks_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); pciide_mapreg_dma(sc, pa); - aprint_normal("\n"); + aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_DATA32; if (sc->sc_dma_ok) { diff --git a/sys/dev/pci/satalink.c b/sys/dev/pci/satalink.c index 3cb739a708d..a08aa2cce9f 100644 --- a/sys/dev/pci/satalink.c +++ b/sys/dev/pci/satalink.c @@ -1,4 +1,4 @@ -/* $NetBSD: satalink.c,v 1.33 2006/11/16 01:33:10 christos Exp $ */ +/* $NetBSD: satalink.c,v 1.34 2007/02/09 21:55:27 ad Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: satalink.c,v 1.33 2006/11/16 01:33:10 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: satalink.c,v 1.34 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -463,10 +463,10 @@ sii3112_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) cfgctl | CFGCTL_BA5INDEN); } - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); pciide_mapreg_dma(sc, pa); - aprint_normal("\n"); + aprint_verbose("\n"); /* * Rev. <= 0x01 of the 3112 have a bug that can cause data @@ -535,7 +535,7 @@ sii3114_mapreg_dma(struct pciide_softc *sc, struct pci_attach_args *pa) if (device_cfdata(&sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags & PCIIDE_OPTIONS_NODMA) { - aprint_normal( + aprint_verbose( ", but unused (forced off by config file)"); sc->sc_dma_ok = 0; return; @@ -558,7 +558,7 @@ sii3114_mapreg_dma(struct pciide_softc *sc, struct pci_attach_args *pa) satalink_ba5_regmap[chan].ba5_IDEDMA_CMD + reg, size, &pc->dma_iohs[reg]) != 0) { sc->sc_dma_ok = 0; - aprint_normal(", but can't subregion offset " + aprint_verbose(", but can't subregion offset " "%lu size %lu", (u_long) satalink_ba5_regmap[ chan].ba5_IDEDMA_CMD + reg, @@ -720,10 +720,10 @@ sii3114_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) */ BA5_WRITE_4(sc, 2, ba5_IDEDMA_CMD, IDEDMA_CMD_INT_STEER); - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); sii3114_mapreg_dma(sc, pa); - aprint_normal("\n"); + aprint_verbose("\n"); sii_fixup_cacheline(sc, pa); diff --git a/sys/dev/pci/siside.c b/sys/dev/pci/siside.c index 1ee2d1c84fe..6bce4a3c057 100644 --- a/sys/dev/pci/siside.c +++ b/sys/dev/pci/siside.c @@ -1,4 +1,4 @@ -/* $NetBSD: siside.c,v 1.21 2006/11/16 01:33:10 christos Exp $ */ +/* $NetBSD: siside.c,v 1.22 2007/02/09 21:55:27 ad Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: siside.c,v 1.21 2006/11/16 01:33:10 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: siside.c,v 1.22 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -271,10 +271,10 @@ sis_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) } aprint_normal(" IDE controller (rev. 0x%02x)\n", PCI_REVISION(pa->pa_class)); - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); pciide_mapreg_dma(sc, pa); - aprint_normal("\n"); + aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_DATA32; if (sc->sc_dma_ok) { @@ -525,10 +525,10 @@ sis_sata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, PCI_REVISION(pa->pa_class)); - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); pciide_mapreg_dma(sc, pa); - aprint_normal("\n"); + aprint_verbose("\n"); if (sc->sc_dma_ok) { sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_UDMA | ATAC_CAP_DMA; diff --git a/sys/dev/pci/slide.c b/sys/dev/pci/slide.c index 0223047a1cc..0749e48b81b 100644 --- a/sys/dev/pci/slide.c +++ b/sys/dev/pci/slide.c @@ -1,4 +1,4 @@ -/* $NetBSD: slide.c,v 1.15 2006/11/16 01:33:10 christos Exp $ */ +/* $NetBSD: slide.c,v 1.16 2007/02/09 21:55:27 ad Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: slide.c,v 1.15 2006/11/16 01:33:10 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: slide.c,v 1.16 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -141,7 +141,7 @@ sl82c105_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); /* @@ -149,11 +149,11 @@ sl82c105_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) * If so, we need to disable DMA on rev. <= 5 of that chip. */ if (pci_find_device(pa, sl82c105_bugchk)) { - aprint_normal(" but disabled due to 83c553 rev. <= 0x05"); + aprint_verbose(" but disabled due to 83c553 rev. <= 0x05"); sc->sc_dma_ok = 0; } else pciide_mapreg_dma(sc, pa); - aprint_normal("\n"); + aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA32 | ATAC_CAP_DATA16; sc->sc_wdcdev.sc_atac.atac_pio_cap = 4; diff --git a/sys/dev/pci/stpcide.c b/sys/dev/pci/stpcide.c index fafb51fcfa4..c9eba3bc700 100644 --- a/sys/dev/pci/stpcide.c +++ b/sys/dev/pci/stpcide.c @@ -1,4 +1,4 @@ -/* $NetBSD: stpcide.c,v 1.16 2006/11/16 01:33:10 christos Exp $ */ +/* $NetBSD: stpcide.c,v 1.17 2007/02/09 21:55:27 ad Exp $ */ /* * Copyright (c) 2003 Tohru Nishimura @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: stpcide.c,v 1.16 2006/11/16 01:33:10 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: stpcide.c,v 1.17 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -93,10 +93,10 @@ stpc_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); pciide_mapreg_dma(sc, pa); - aprint_normal("\n"); + aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DATA16 | ATAC_CAP_DATA32; if (sc->sc_dma_ok) { sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DMA; diff --git a/sys/dev/pci/viaide.c b/sys/dev/pci/viaide.c index 9d6cb6ff0e5..57574abdd56 100644 --- a/sys/dev/pci/viaide.c +++ b/sys/dev/pci/viaide.c @@ -1,4 +1,4 @@ -/* $NetBSD: viaide.c,v 1.38 2007/01/21 05:00:34 isaki Exp $ */ +/* $NetBSD: viaide.c,v 1.39 2007/02/09 21:55:27 ad Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: viaide.c,v 1.38 2007/01/21 05:00:34 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: viaide.c,v 1.39 2007/02/09 21:55:27 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -463,10 +463,10 @@ unknown: panic("via_chip_map: unknown vendor"); } - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); pciide_mapreg_dma(sc, pa); - aprint_normal("\n"); + aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_DATA32; if (sc->sc_dma_ok) { sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DMA; @@ -661,10 +661,10 @@ via_sata_chip_map_common(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return 0; - aprint_normal("%s: bus-master DMA support present", + aprint_verbose("%s: bus-master DMA support present", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); pciide_mapreg_dma(sc, pa); - aprint_normal("\n"); + aprint_verbose("\n"); if (sc->sc_dma_ok) { sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_UDMA | ATAC_CAP_DMA; diff --git a/sys/dev/sbus/bpp.c b/sys/dev/sbus/bpp.c index 3e6ef0fd18c..f36b45a1b78 100644 --- a/sys/dev/sbus/bpp.c +++ b/sys/dev/sbus/bpp.c @@ -1,4 +1,4 @@ -/* $NetBSD: bpp.c,v 1.26 2006/10/15 19:29:10 martin Exp $ */ +/* $NetBSD: bpp.c,v 1.27 2007/02/09 21:55:29 ad Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: bpp.c,v 1.26 2006/10/15 19:29:10 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bpp.c,v 1.27 2007/02/09 21:55:29 ad Exp $"); #include <sys/param.h> #include <sys/ioctl.h> @@ -612,8 +612,11 @@ bppintr(arg) wakeup(sc->sc_buf); } else { selnotify(&sc->sc_wsel, 0); - if (sc->sc_asyncproc != NULL) + if (sc->sc_asyncproc != NULL) { + mutex_enter(&proclist_mutex); psignal(sc->sc_asyncproc, SIGIO); + mutex_exit(&proclist_mutex); + } } return (1); } diff --git a/sys/dev/scsipi/scsipi_base.c b/sys/dev/scsipi/scsipi_base.c index 1f2e59c2c93..0a9055fe531 100644 --- a/sys/dev/scsipi/scsipi_base.c +++ b/sys/dev/scsipi/scsipi_base.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsipi_base.c,v 1.142 2006/11/26 05:01:09 itohy Exp $ */ +/* $NetBSD: scsipi_base.c,v 1.143 2007/02/09 21:55:29 ad Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.142 2006/11/26 05:01:09 itohy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.143 2007/02/09 21:55:29 ad Exp $"); #include "opt_scsi.h" @@ -2080,9 +2080,8 @@ scsipi_completion_thread(void *arg) ADAPTER_REQ_GROW_RESOURCES, NULL); scsipi_channel_thaw(chan, 1); splx(s); - if (chan->chan_tflags & SCSIPI_CHANT_GROWRES) { - preempt(1); - } + if (chan->chan_tflags & SCSIPI_CHANT_GROWRES) + kpause("scsizzz", FALSE, hz/10, NULL); continue; } if (chan->chan_tflags & SCSIPI_CHANT_KICK) { diff --git a/sys/dev/sequencer.c b/sys/dev/sequencer.c index 1fc8d70e1a8..a28abc3c8c1 100644 --- a/sys/dev/sequencer.c +++ b/sys/dev/sequencer.c @@ -1,4 +1,4 @@ -/* $NetBSD: sequencer.c,v 1.38 2006/11/24 19:46:59 christos Exp $ */ +/* $NetBSD: sequencer.c,v 1.39 2007/02/09 21:55:26 ad Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.38 2006/11/24 19:46:59 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.39 2007/02/09 21:55:26 ad Exp $"); #include "sequencer.h" @@ -109,6 +109,7 @@ static int seq_to_new(seq_event_t *, struct uio *); static int seq_sleep_timo(int *, const char *, int); static int seq_sleep(int *, const char *); static void seq_wakeup(int *); +static void seq_softintr(void *); struct midi_softc; static int midiseq_out(struct midi_dev *, u_char *, u_int, int); @@ -142,9 +143,13 @@ const struct cdevsw sequencer_cdevsw = { void sequencerattach(int n) { + struct sequencer_softc *sc; - for (n = 0; n < NSEQUENCER; n++) - callout_init(&seqdevs[n].sc_callout); + for (n = 0; n < NSEQUENCER; n++) { + sc = &seqdevs[n]; + callout_init(&sc->sc_callout); + sc->sih = softintr_establish(IPL_SOFTSERIAL, seq_softintr, sc); + } } static int @@ -256,14 +261,20 @@ static void seq_timeout(void *addr) { struct sequencer_softc *sc = addr; + struct proc *p; + DPRINTFN(4, ("seq_timeout: %p\n", sc)); sc->timeout = 0; seq_startoutput(sc); if (SEQ_QLEN(&sc->outq) < sc->lowat) { seq_wakeup(&sc->wchan); selnotify(&sc->wsel, 0); - if (sc->async) - psignal(sc->async, SIGIO); + if (sc->async != NULL) { + mutex_enter(&proclist_mutex); + if ((p = sc->async) != NULL) + psignal(p, SIGIO); + mutex_exit(&proclist_mutex); + } } } @@ -307,6 +318,22 @@ sequencerclose(dev_t dev, int flags, int ifmt, return (0); } +static void +seq_softintr(void *cookie) +{ + struct sequencer_softc *sc = cookie; + struct proc *p; + + seq_wakeup(&sc->rchan); + selnotify(&sc->rsel, 0); + if (sc->async != NULL) { + mutex_enter(&proclist_mutex); + if ((p = sc->async) != NULL) + psignal(p, SIGIO); + mutex_exit(&proclist_mutex); + } +} + static int seq_input_event(struct sequencer_softc *sc, seq_event_t *cmd) { @@ -321,10 +348,7 @@ seq_input_event(struct sequencer_softc *sc, seq_event_t *cmd) if (SEQ_QFULL(q)) return (ENOMEM); SEQ_QPUT(q, *cmd); - seq_wakeup(&sc->rchan); - selnotify(&sc->rsel, 0); - if (sc->async) - psignal(sc->async, SIGIO); + softintr_schedule(sc->sih); return 0; } diff --git a/sys/dev/sequencervar.h b/sys/dev/sequencervar.h index 1228549e625..67693e57443 100644 --- a/sys/dev/sequencervar.h +++ b/sys/dev/sequencervar.h @@ -1,4 +1,4 @@ -/* $NetBSD: sequencervar.h,v 1.11 2006/06/30 13:56:25 chap Exp $ */ +/* $NetBSD: sequencervar.h,v 1.12 2007/02/09 21:55:26 ad Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -92,6 +92,7 @@ struct sequencer_softc { struct selinfo wsel; /* write selector */ struct selinfo rsel; /* read selector */ struct proc *async; /* process who wants audio SIGIO */ + void *sih; int nmidi; /* number of MIDI devices */ struct midi_dev **devs; diff --git a/sys/dev/sun/event_var.h b/sys/dev/sun/event_var.h index 57899afc306..49dde963e16 100644 --- a/sys/dev/sun/event_var.h +++ b/sys/dev/sun/event_var.h @@ -1,4 +1,4 @@ -/* $NetBSD: event_var.h,v 1.9 2005/12/11 12:23:56 christos Exp $ */ +/* $NetBSD: event_var.h,v 1.10 2007/02/09 21:55:29 ad Exp $ */ /* * Copyright (c) 1992, 1993 @@ -68,8 +68,11 @@ struct evvar { (ev)->ev_wanted = 0; \ wakeup((caddr_t)(ev)); \ } \ - if ((ev)->ev_async) \ + if ((ev)->ev_async) { \ + mutex_enter(&proclist_mutex); \ psignal((ev)->ev_io, SIGIO); \ + mutex_exit(&proclist_mutex); \ + } \ } void ev_init(struct evvar *); diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c index db5818a11ad..4e2d71ff2eb 100644 --- a/sys/dev/usb/ehci.c +++ b/sys/dev/usb/ehci.c @@ -1,4 +1,4 @@ -/* $NetBSD: ehci.c,v 1.120 2007/01/19 22:46:21 drochner Exp $ */ +/* $NetBSD: ehci.c,v 1.121 2007/02/09 21:55:29 ad Exp $ */ /* * Copyright (c) 2004,2005 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.120 2007/01/19 22:46:21 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.121 2007/02/09 21:55:29 ad Exp $"); #include "ohci.h" #include "uhci.h" @@ -334,7 +334,7 @@ ehci_init(ehci_softc_t *sc) sc->sc_offs = EREAD1(sc, EHCI_CAPLENGTH); vers = EREAD2(sc, EHCI_HCIVERSION); - aprint_normal("%s: EHCI version %x.%x\n", USBDEVNAME(sc->sc_bus.bdev), + aprint_verbose("%s: EHCI version %x.%x\n", USBDEVNAME(sc->sc_bus.bdev), vers >> 8, vers & 0xff); sparams = EREAD4(sc, EHCI_HCSPARAMS); @@ -342,7 +342,7 @@ ehci_init(ehci_softc_t *sc) sc->sc_npcomp = EHCI_HCS_N_PCC(sparams); ncomp = EHCI_HCS_N_CC(sparams); if (ncomp != sc->sc_ncomp) { - aprint_error("%s: wrong number of companions (%d != %d)\n", + aprint_verbose("%s: wrong number of companions (%d != %d)\n", USBDEVNAME(sc->sc_bus.bdev), ncomp, sc->sc_ncomp); #if NOHCI == 0 || NUHCI == 0 diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index 30fb4ebb7a9..96ee0cd6686 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -1,4 +1,4 @@ -/* $NetBSD: uhid.c,v 1.73 2006/12/03 22:34:58 pavel Exp $ */ +/* $NetBSD: uhid.c,v 1.74 2007/02/09 21:55:29 ad Exp $ */ /* * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uhid.c,v 1.73 2006/12/03 22:34:58 pavel Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uhid.c,v 1.74 2007/02/09 21:55:29 ad Exp $"); #include "opt_compat_netbsd.h" @@ -252,7 +252,9 @@ uhid_intr(struct uhidev *addr, void *data, u_int len) selnotify(&sc->sc_rsel, 0); if (sc->sc_async != NULL) { DPRINTFN(3, ("uhid_intr: sending SIGIO %p\n", sc->sc_async)); + mutex_enter(&proclist_mutex); psignal(sc->sc_async, SIGIO); + mutex_exit(&proclist_mutex); } } diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index 4d4538bf4b9..d55b14d26cd 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -1,4 +1,4 @@ -/* $NetBSD: usb.c,v 1.93 2006/12/05 17:35:35 christos Exp $ */ +/* $NetBSD: usb.c,v 1.94 2007/02/09 21:55:29 ad Exp $ */ /* * Copyright (c) 1998, 2002 The NetBSD Foundation, Inc. @@ -44,7 +44,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.93 2006/12/05 17:35:35 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.94 2007/02/09 21:55:29 ad Exp $"); #include "opt_compat_netbsd.h" @@ -864,8 +864,11 @@ usb_add_event(int type, struct usb_event *uep) SIMPLEQ_INSERT_TAIL(&usb_events, ueq, next); wakeup(&usb_events); selnotify(&usb_selevent, 0); - if (usb_async_proc != NULL) + if (usb_async_proc != NULL) { + mutex_enter(&proclist_mutex); psignal(usb_async_proc, SIGIO); + mutex_exit(&proclist_mutex); + } splx(s); } diff --git a/sys/dev/wscons/wsdisplay_compat_usl.c b/sys/dev/wscons/wsdisplay_compat_usl.c index 76da1fb631a..39b8457ad04 100644 --- a/sys/dev/wscons/wsdisplay_compat_usl.c +++ b/sys/dev/wscons/wsdisplay_compat_usl.c @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_compat_usl.c,v 1.38 2006/12/26 16:42:07 elad Exp $ */ +/* $NetBSD: wsdisplay_compat_usl.c,v 1.39 2007/02/09 21:55:30 ad Exp $ */ /* * Copyright (c) 1998 @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_compat_usl.c,v 1.38 2006/12/26 16:42:07 elad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_compat_usl.c,v 1.39 2007/02/09 21:55:30 ad Exp $"); #include "opt_compat_freebsd.h" #include "opt_compat_netbsd.h" @@ -138,7 +138,11 @@ usl_sync_done(struct usl_syncdata *sd) static int usl_sync_check(struct usl_syncdata *sd) { - if (sd->s_proc == pfind(sd->s_pid)) + int rv; + mutex_enter(&proclist_mutex); /* XXXSMP */ + rv = (sd->s_proc == p_find(sd->s_pid, PFIND_LOCKED)); + mutex_exit(&proclist_mutex); /* XXXSMP */ + if (rv) return (1); printf("usl_sync_check: process %d died\n", sd->s_pid); usl_sync_done(sd); @@ -176,7 +180,9 @@ usl_detachproc(void *cookie, int waitok, sd->s_callback = callback; sd->s_cbarg = cbarg; sd->s_flags |= SF_DETACHPENDING; + mutex_enter(&proclist_mutex); psignal(sd->s_proc, sd->s_relsig); + mutex_exit(&proclist_mutex); callout_reset(&sd->s_detach_ch, wscompat_usl_synctimeout * hz, usl_detachtimeout, sd); @@ -236,7 +242,9 @@ usl_attachproc(void *cookie, int waitok, sd->s_callback = callback; sd->s_cbarg = cbarg; sd->s_flags |= SF_ATTACHPENDING; + mutex_enter(&proclist_mutex); psignal(sd->s_proc, sd->s_acqsig); + mutex_exit(&proclist_mutex); callout_reset(&sd->s_attach_ch, wscompat_usl_synctimeout * hz, usl_attachtimeout, sd); diff --git a/sys/dev/wscons/wsevent.c b/sys/dev/wscons/wsevent.c index bd83b647d1f..aacc3a78d53 100644 --- a/sys/dev/wscons/wsevent.c +++ b/sys/dev/wscons/wsevent.c @@ -1,4 +1,4 @@ -/* $NetBSD: wsevent.c,v 1.22 2006/11/16 01:33:31 christos Exp $ */ +/* $NetBSD: wsevent.c,v 1.23 2007/02/09 21:55:30 ad Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -111,7 +111,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.22 2006/11/16 01:33:31 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.23 2007/02/09 21:55:30 ad Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -325,8 +325,11 @@ wsevent_wakeup(struct wseventvar *ev) wakeup(ev); } - if (ev->async) + if (ev->async) { + mutex_enter(&proclist_mutex); psignal(ev->io, SIGIO); + mutex_exit(&proclist_mutex); + } } /* diff --git a/sys/dev/wscons/wskbd.c b/sys/dev/wscons/wskbd.c index cb8a0ded2e4..4207babfb1d 100644 --- a/sys/dev/wscons/wskbd.c +++ b/sys/dev/wscons/wskbd.c @@ -1,4 +1,4 @@ -/* $NetBSD: wskbd.c,v 1.99 2007/01/04 18:44:46 elad Exp $ */ +/* $NetBSD: wskbd.c,v 1.100 2007/02/09 21:55:30 ad Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -79,7 +79,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.99 2007/01/04 18:44:46 elad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.100 2007/02/09 21:55:30 ad Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -1270,10 +1270,10 @@ wskbd_set_display(struct device *dv, struct wsevsrc *me) } if (displaydv) - printf("%s: connecting to %s\n", + aprint_verbose("%s: connecting to %s\n", sc->sc_base.me_dv.dv_xname, displaydv->dv_xname); else - printf("%s: disconnecting from %s\n", + aprint_verbose("%s: disconnecting from %s\n", sc->sc_base.me_dv.dv_xname, odisplaydv->dv_xname); return (0); diff --git a/sys/dev/wscons/wsmux.c b/sys/dev/wscons/wsmux.c index 79a3b8ad391..a242be2172f 100644 --- a/sys/dev/wscons/wsmux.c +++ b/sys/dev/wscons/wsmux.c @@ -1,4 +1,4 @@ -/* $NetBSD: wsmux.c,v 1.46 2006/11/16 01:33:31 christos Exp $ */ +/* $NetBSD: wsmux.c,v 1.47 2007/02/09 21:55:30 ad Exp $ */ /* * Copyright (c) 1998, 2005 The NetBSD Foundation, Inc. @@ -44,7 +44,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wsmux.c,v 1.46 2006/11/16 01:33:31 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsmux.c,v 1.47 2007/02/09 21:55:30 ad Exp $"); #include "wsdisplay.h" #include "wsmux.h" @@ -840,7 +840,7 @@ wsmux_set_display(struct wsmux_softc *sc, struct device *displaydv) sc->sc_base.me_dispdv = displaydv; if (displaydv) - printf("%s: connecting to %s\n", + aprint_verbose("%s: connecting to %s\n", sc->sc_base.me_dv.dv_xname, displaydv->dv_xname); ok = 0; error = 0; @@ -870,7 +870,7 @@ wsmux_set_display(struct wsmux_softc *sc, struct device *displaydv) error = 0; if (displaydv == NULL) - printf("%s: disconnecting from %s\n", + aprint_verbose("%s: disconnecting from %s\n", sc->sc_base.me_dv.dv_xname, odisplaydv->dv_xname); return (error); |
