summaryrefslogtreecommitdiff
path: root/sys/dev/ata
diff options
context:
space:
mode:
authorbouyer <bouyer@NetBSD.org>2008-10-02 21:05:17 +0000
committerbouyer <bouyer@NetBSD.org>2008-10-02 21:05:17 +0000
commit2887906e27ecfa60fbd7d0e8b06c23e6d2d993b7 (patch)
tree05bfe4a55cacd093912f1c6973ab39c11a88e1ee /sys/dev/ata
parent21150ac7ce53baead83f92ae96da829215152a5b (diff)
Kill ATACH_TH_RUN and use cpu_intr_p() instead.
Diffstat (limited to 'sys/dev/ata')
-rw-r--r--sys/dev/ata/ata.c21
-rw-r--r--sys/dev/ata/ata_wdc.c8
-rw-r--r--sys/dev/ata/atavar.h3
3 files changed, 9 insertions, 23 deletions
diff --git a/sys/dev/ata/ata.c b/sys/dev/ata/ata.c
index 8218e494378..b8622d580fb 100644
--- a/sys/dev/ata/ata.c
+++ b/sys/dev/ata/ata.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ata.c,v 1.100 2008/10/01 18:23:55 bouyer Exp $ */
+/* $NetBSD: ata.c,v 1.101 2008/10/02 21:05:17 bouyer 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.100 2008/10/01 18:23:55 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.101 2008/10/02 21:05:17 bouyer Exp $");
#include "opt_ata.h"
@@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.100 2008/10/01 18:23:55 bouyer Exp $");
#include <sys/conf.h>
#include <sys/fcntl.h>
#include <sys/proc.h>
+#include <sys/cpu.h>
#include <sys/pool.h>
#include <sys/kthread.h>
#include <sys/errno.h>
@@ -179,12 +180,7 @@ atabusconfig(struct atabus_softc *atabus_sc)
struct ata_channel *chp = atabus_sc->sc_chan;
struct atac_softc *atac = chp->ch_atac;
struct atabus_initq *atabus_initq = NULL;
- int i, s, error;
-
- /* we are in the atabus's thread context */
- s = splbio();
- chp->ch_flags |= ATACH_TH_RUN;
- splx(s);
+ int i, error;
/* Probe for the drives. */
/* XXX for SATA devices we will power up all drives at once */
@@ -194,11 +190,6 @@ atabusconfig(struct atabus_softc *atabus_sc)
chp->ch_drive[0].drive_flags, chp->ch_drive[1].drive_flags),
DEBUG_PROBE);
- /* next operations will occurs in a separate thread */
- s = splbio();
- chp->ch_flags &= ~ATACH_TH_RUN;
- splx(s);
-
/* Make sure the devices probe in atabus order to avoid jitter. */
simple_lock(&atabus_interlock);
while(1) {
@@ -357,8 +348,6 @@ atabus_thread(void *arg)
int i, s;
s = splbio();
- chp->ch_flags |= ATACH_TH_RUN;
-
/*
* Probe the drives. Reset all flags to 0 to indicate to controllers
* that can re-probe that all drives must be probed..
@@ -377,9 +366,7 @@ atabus_thread(void *arg)
if ((chp->ch_flags & (ATACH_TH_RESET | ATACH_SHUTDOWN)) == 0 &&
(chp->ch_queue->active_xfer == NULL ||
chp->ch_queue->queue_freeze == 0)) {
- chp->ch_flags &= ~ATACH_TH_RUN;
(void) tsleep(&chp->ch_thread, PRIBIO, "atath", 0);
- chp->ch_flags |= ATACH_TH_RUN;
}
if (chp->ch_flags & ATACH_SHUTDOWN) {
break;
diff --git a/sys/dev/ata/ata_wdc.c b/sys/dev/ata/ata_wdc.c
index 0c501f485b9..e7f020be617 100644
--- a/sys/dev/ata/ata_wdc.c
+++ b/sys/dev/ata/ata_wdc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ata_wdc.c,v 1.89 2008/04/28 20:23:47 martin Exp $ */
+/* $NetBSD: ata_wdc.c,v 1.90 2008/10/02 21:05:17 bouyer Exp $ */
/*
* Copyright (c) 1998, 2001, 2003 Manuel Bouyer.
@@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.89 2008/04/28 20:23:47 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.90 2008/10/02 21:05:17 bouyer Exp $");
#include "opt_ata.h"
@@ -75,6 +75,7 @@ __KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.89 2008/04/28 20:23:47 martin Exp $");
#include <sys/disklabel.h>
#include <sys/syslog.h>
#include <sys/proc.h>
+#include <sys/cpu.h>
#include <sys/intr.h>
#include <sys/bus.h>
@@ -198,8 +199,7 @@ wdc_ata_bio_start(struct ata_channel *chp, struct ata_xfer *xfer)
* that we never get to this point if that's the case.
*/
/* If it's not a polled command, we need the kernel thread */
- if ((xfer->c_flags & C_POLL) == 0 &&
- (chp->ch_flags & ATACH_TH_RUN) == 0) {
+ if ((xfer->c_flags & C_POLL) == 0 && cpu_intr_p()) {
chp->ch_queue->queue_freeze++;
wakeup(&chp->ch_thread);
return;
diff --git a/sys/dev/ata/atavar.h b/sys/dev/ata/atavar.h
index 8ac43f8055c..3613549e2c0 100644
--- a/sys/dev/ata/atavar.h
+++ b/sys/dev/ata/atavar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: atavar.h,v 1.76 2008/03/18 20:46:36 cube Exp $ */
+/* $NetBSD: atavar.h,v 1.77 2008/10/02 21:05:17 bouyer Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -340,7 +340,6 @@ struct ata_channel {
#define ATACH_DMA_WAIT 0x20 /* controller is waiting for DMA */
#define ATACH_PIOBM_WAIT 0x40 /* controller is waiting for busmastering PIO */
#define ATACH_DISABLED 0x80 /* channel is disabled */
-#define ATACH_TH_RUN 0x100 /* the kernel thread is working */
#define ATACH_TH_RESET 0x200 /* someone ask the thread to reset */
u_int8_t ch_status; /* copy of status register */
u_int8_t ch_error; /* copy of error register */