Move wdc_exec_xfer() to ata.c and rename it ata_exec_xfer().

This commit is contained in:
thorpej 2004-08-13 02:10:43 +00:00
parent d949dd984b
commit 996c3ca90e
6 changed files with 35 additions and 32 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ata.c,v 1.43 2004/08/12 22:39:40 thorpej Exp $ */
/* $NetBSD: ata.c,v 1.44 2004/08/13 02:10:43 thorpej 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.43 2004/08/12 22:39:40 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.44 2004/08/13 02:10:43 thorpej Exp $");
#ifndef WDCDEBUG
#define WDCDEBUG
@ -62,6 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.43 2004/08/12 22:39:40 thorpej Exp $");
#define DEBUG_FUNCS 0x08
#define DEBUG_PROBE 0x10
#define DEBUG_DETACH 0x20
#define DEBUG_XFERS 0x40
#ifdef WDCDEBUG
extern int wdcdebug_mask; /* init'ed in wdc.c */
#define WDCDEBUG_PRINT(args, level) \
@ -500,6 +501,26 @@ ata_dmaerr(struct ata_drive_datas *drvp, int flags)
}
}
/*
* Add a command to the queue and start controller. Must be called at splbio
*/
void
ata_exec_xfer(struct wdc_channel *chp, struct ata_xfer *xfer)
{
WDCDEBUG_PRINT(("ata_exec_xfer %p channel %d drive %d\n", xfer,
chp->ch_channel, xfer->c_drive), DEBUG_XFERS);
/* complete xfer setup */
xfer->c_chp = chp;
/* insert at the end of command list */
TAILQ_INSERT_TAIL(&chp->ch_queue->queue_xfer, xfer, c_xferchain);
WDCDEBUG_PRINT(("wdcstart from ata_exec_xfer, flags 0x%x\n",
chp->ch_flags), DEBUG_XFERS);
wdcstart(chp);
}
struct ata_xfer *
ata_get_xfer(int flags)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: ata_wdc.c,v 1.67 2004/08/12 22:39:40 thorpej Exp $ */
/* $NetBSD: ata_wdc.c,v 1.68 2004/08/13 02:10:43 thorpej Exp $ */
/*
* Copyright (c) 1998, 2001, 2003 Manuel Bouyer.
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.67 2004/08/12 22:39:40 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.68 2004/08/13 02:10:43 thorpej Exp $");
#ifndef WDCDEBUG
#define WDCDEBUG
@ -193,7 +193,7 @@ wdc_ata_bio(struct ata_drive_datas *drvp, struct ata_bio *ata_bio)
xfer->c_start = wdc_ata_bio_start;
xfer->c_intr = wdc_ata_bio_intr;
xfer->c_kill_xfer = wdc_ata_bio_kill_xfer;
wdc_exec_xfer(chp, xfer);
ata_exec_xfer(chp, xfer);
return (ata_bio->flags & ATA_ITSDONE) ? ATACMD_COMPLETE : ATACMD_QUEUED;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: atavar.h,v 1.56 2004/08/12 22:39:41 thorpej Exp $ */
/* $NetBSD: atavar.h,v 1.57 2004/08/13 02:10:43 thorpej Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer.
@ -313,6 +313,7 @@ void ata_free_xfer(struct wdc_channel *, struct ata_xfer *);
#define ATAXF_CANSLEEP 0x00
#define ATAXF_NOSLEEP 0x01
void ata_exec_xfer(struct wdc_channel *, struct ata_xfer *);
void ata_kill_pending(struct ata_drive_datas *);
int ata_addref(struct wdc_channel *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: wdc.c,v 1.200 2004/08/12 22:39:41 thorpej Exp $ */
/* $NetBSD: wdc.c,v 1.201 2004/08/13 02:10:43 thorpej Exp $ */
/*
* Copyright (c) 1998, 2001, 2003 Manuel Bouyer. All rights reserved.
@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.200 2004/08/12 22:39:41 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.201 2004/08/13 02:10:43 thorpej Exp $");
#ifndef WDCDEBUG
#define WDCDEBUG
@ -1449,7 +1449,7 @@ wdc_exec_command(struct ata_drive_datas *drvp, struct ata_command *ata_c)
xfer->c_kill_xfer = __wdccommand_kill_xfer;
s = splbio();
wdc_exec_xfer(chp, xfer);
ata_exec_xfer(chp, xfer);
#ifdef DIAGNOSTIC
if ((ata_c->flags & AT_POLL) != 0 &&
(ata_c->flags & AT_DONE) == 0)
@ -1807,24 +1807,6 @@ wdccommandshort(struct wdc_channel *chp, int drive, int command)
bus_space_write_1(chp->cmd_iot, chp->cmd_iohs[wd_command], 0, command);
}
/* Add a command to the queue and start controller. Must be called at splbio */
void
wdc_exec_xfer(struct wdc_channel *chp, struct ata_xfer *xfer)
{
WDCDEBUG_PRINT(("wdc_exec_xfer %p channel %d drive %d\n", xfer,
chp->ch_channel, xfer->c_drive), DEBUG_XFERS);
/* complete xfer setup */
xfer->c_chp = chp;
/* insert at the end of command list */
TAILQ_INSERT_TAIL(&chp->ch_queue->queue_xfer, xfer, c_xferchain);
WDCDEBUG_PRINT(("wdcstart from wdc_exec_xfer, flags 0x%x\n",
chp->ch_flags), DEBUG_XFERS);
wdcstart(chp);
}
static void
__wdcerror(struct wdc_channel *chp, char *msg)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: wdcvar.h,v 1.71 2004/08/12 22:39:41 thorpej Exp $ */
/* $NetBSD: wdcvar.h,v 1.72 2004/08/13 02:10:43 thorpej Exp $ */
/*-
* Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@ -191,7 +191,6 @@ void wdcattach(struct wdc_channel *);
int wdcdetach(struct device *, int);
int wdcactivate(struct device *, enum devact);
int wdcintr(void *);
void wdc_exec_xfer(struct wdc_channel *, struct ata_xfer *);
void wdcstart(struct wdc_channel *);
void wdcrestart(void*);

View File

@ -1,4 +1,4 @@
/* $NetBSD: atapi_wdc.c,v 1.82 2004/08/12 22:39:41 thorpej Exp $ */
/* $NetBSD: atapi_wdc.c,v 1.83 2004/08/13 02:10:43 thorpej Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.82 2004/08/12 22:39:41 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.83 2004/08/13 02:10:43 thorpej Exp $");
#ifndef WDCDEBUG
#define WDCDEBUG
@ -386,7 +386,7 @@ wdc_atapi_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
xfer->c_kill_xfer = wdc_atapi_kill_xfer;
xfer->c_dscpoll = 0;
s = splbio();
wdc_exec_xfer(wdc->channels[channel], xfer);
ata_exec_xfer(wdc->channels[channel], xfer);
#ifdef DIAGNOSTIC
if ((sc_xfer->xs_control & XS_CTL_POLL) != 0 &&
(sc_xfer->xs_status & XS_STS_DONE) == 0)