Move wdc_addref() and wdc_delref() to ata.c and rename them to
ata_*.
This commit is contained in:
parent
2eaa5c6142
commit
e6d61c5bc9
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: ata.c,v 1.42 2004/08/12 22:33:46 thorpej Exp $ */
|
/* $NetBSD: ata.c,v 1.43 2004/08/12 22:39:40 thorpej Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
|
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.42 2004/08/12 22:33:46 thorpej Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.43 2004/08/12 22:39:40 thorpej Exp $");
|
||||||
|
|
||||||
#ifndef WDCDEBUG
|
#ifndef WDCDEBUG
|
||||||
#define WDCDEBUG
|
#define WDCDEBUG
|
||||||
|
@ -240,7 +240,7 @@ atabus_attach(struct device *parent, struct device *self, void *aux)
|
||||||
aprint_normal("\n");
|
aprint_normal("\n");
|
||||||
aprint_naive("\n");
|
aprint_naive("\n");
|
||||||
|
|
||||||
if (wdc_addref(chp))
|
if (ata_addref(chp))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
initq = malloc(sizeof(*initq), M_DEVBUF, M_WAITOK);
|
initq = malloc(sizeof(*initq), M_DEVBUF, M_WAITOK);
|
||||||
|
@ -563,6 +563,38 @@ ata_kill_pending(struct ata_drive_datas *drvp)
|
||||||
splx(s);
|
splx(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
ata_addref(struct wdc_channel *chp)
|
||||||
|
{
|
||||||
|
struct wdc_softc *wdc = chp->ch_wdc;
|
||||||
|
struct scsipi_adapter *adapt = &wdc->sc_atapi_adapter._generic;
|
||||||
|
int s, error = 0;
|
||||||
|
|
||||||
|
s = splbio();
|
||||||
|
if (adapt->adapt_refcnt++ == 0 &&
|
||||||
|
adapt->adapt_enable != NULL) {
|
||||||
|
error = (*adapt->adapt_enable)(&wdc->sc_dev, 1);
|
||||||
|
if (error)
|
||||||
|
adapt->adapt_refcnt--;
|
||||||
|
}
|
||||||
|
splx(s);
|
||||||
|
return (error);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ata_delref(struct wdc_channel *chp)
|
||||||
|
{
|
||||||
|
struct wdc_softc *wdc = chp->ch_wdc;
|
||||||
|
struct scsipi_adapter *adapt = &wdc->sc_atapi_adapter._generic;
|
||||||
|
int s;
|
||||||
|
|
||||||
|
s = splbio();
|
||||||
|
if (adapt->adapt_refcnt-- == 1 &&
|
||||||
|
adapt->adapt_enable != NULL)
|
||||||
|
(void) (*adapt->adapt_enable)(&wdc->sc_dev, 0);
|
||||||
|
splx(s);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ata_print_modes(struct wdc_channel *chp)
|
ata_print_modes(struct wdc_channel *chp)
|
||||||
{
|
{
|
||||||
|
@ -888,7 +920,7 @@ int atabusopen(dev, flag, fmt, p)
|
||||||
if (sc->sc_flags & ATABUSCF_OPEN)
|
if (sc->sc_flags & ATABUSCF_OPEN)
|
||||||
return (EBUSY);
|
return (EBUSY);
|
||||||
|
|
||||||
if ((error = wdc_addref(sc->sc_chan)) != 0)
|
if ((error = ata_addref(sc->sc_chan)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
sc->sc_flags |= ATABUSCF_OPEN;
|
sc->sc_flags |= ATABUSCF_OPEN;
|
||||||
|
@ -905,7 +937,7 @@ atabusclose(dev, flag, fmt, p)
|
||||||
{
|
{
|
||||||
struct atabus_softc *sc = atabus_cd.cd_devs[minor(dev)];
|
struct atabus_softc *sc = atabus_cd.cd_devs[minor(dev)];
|
||||||
|
|
||||||
wdc_delref(sc->sc_chan);
|
ata_delref(sc->sc_chan);
|
||||||
|
|
||||||
sc->sc_flags &= ~ATABUSCF_OPEN;
|
sc->sc_flags &= ~ATABUSCF_OPEN;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: ata_wdc.c,v 1.66 2004/08/12 22:33:46 thorpej Exp $ */
|
/* $NetBSD: ata_wdc.c,v 1.67 2004/08/12 22:39:40 thorpej Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2001, 2003 Manuel Bouyer.
|
* Copyright (c) 1998, 2001, 2003 Manuel Bouyer.
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.66 2004/08/12 22:33:46 thorpej Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.67 2004/08/12 22:39:40 thorpej Exp $");
|
||||||
|
|
||||||
#ifndef WDCDEBUG
|
#ifndef WDCDEBUG
|
||||||
#define WDCDEBUG
|
#define WDCDEBUG
|
||||||
|
@ -772,7 +772,7 @@ wdc_ata_addref(struct ata_drive_datas *drvp)
|
||||||
{
|
{
|
||||||
struct wdc_channel *chp = drvp->chnl_softc;
|
struct wdc_channel *chp = drvp->chnl_softc;
|
||||||
|
|
||||||
return (wdc_addref(chp));
|
return (ata_addref(chp));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -780,5 +780,5 @@ wdc_ata_delref(struct ata_drive_datas *drvp)
|
||||||
{
|
{
|
||||||
struct wdc_channel *chp = drvp->chnl_softc;
|
struct wdc_channel *chp = drvp->chnl_softc;
|
||||||
|
|
||||||
wdc_delref(chp);
|
ata_delref(chp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: atavar.h,v 1.55 2004/08/12 22:33:46 thorpej Exp $ */
|
/* $NetBSD: atavar.h,v 1.56 2004/08/12 22:39:41 thorpej Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2001 Manuel Bouyer.
|
* Copyright (c) 1998, 2001 Manuel Bouyer.
|
||||||
|
@ -315,6 +315,8 @@ void ata_free_xfer(struct wdc_channel *, struct ata_xfer *);
|
||||||
|
|
||||||
void ata_kill_pending(struct ata_drive_datas *);
|
void ata_kill_pending(struct ata_drive_datas *);
|
||||||
|
|
||||||
|
int ata_addref(struct wdc_channel *);
|
||||||
|
void ata_delref(struct wdc_channel *);
|
||||||
void ata_print_modes(struct wdc_channel *);
|
void ata_print_modes(struct wdc_channel *);
|
||||||
int ata_downgrade_mode(struct ata_drive_datas *, int);
|
int ata_downgrade_mode(struct ata_drive_datas *, int);
|
||||||
void ata_probe_caps(struct ata_drive_datas *);
|
void ata_probe_caps(struct ata_drive_datas *);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: wdc.c,v 1.199 2004/08/12 22:33:45 thorpej Exp $ */
|
/* $NetBSD: wdc.c,v 1.200 2004/08/12 22:39:41 thorpej Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2001, 2003 Manuel Bouyer. All rights reserved.
|
* Copyright (c) 1998, 2001, 2003 Manuel Bouyer. All rights reserved.
|
||||||
|
@ -70,7 +70,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.199 2004/08/12 22:33:45 thorpej Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.200 2004/08/12 22:39:41 thorpej Exp $");
|
||||||
|
|
||||||
#ifndef WDCDEBUG
|
#ifndef WDCDEBUG
|
||||||
#define WDCDEBUG
|
#define WDCDEBUG
|
||||||
|
@ -469,7 +469,7 @@ atabusconfig(struct atabus_softc *atabus_sc)
|
||||||
free(atabus_initq, M_DEVBUF);
|
free(atabus_initq, M_DEVBUF);
|
||||||
wakeup(&atabus_initq_head);
|
wakeup(&atabus_initq_head);
|
||||||
|
|
||||||
wdc_delref(chp);
|
ata_delref(chp);
|
||||||
|
|
||||||
config_pending_decr();
|
config_pending_decr();
|
||||||
}
|
}
|
||||||
|
@ -1852,38 +1852,6 @@ wdcbit_bucket(struct wdc_channel *chp, int size)
|
||||||
(void)bus_space_read_1(chp->cmd_iot, chp->cmd_iohs[wd_data], 0);
|
(void)bus_space_read_1(chp->cmd_iot, chp->cmd_iohs[wd_data], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
wdc_addref(struct wdc_channel *chp)
|
|
||||||
{
|
|
||||||
struct wdc_softc *wdc = chp->ch_wdc;
|
|
||||||
struct scsipi_adapter *adapt = &wdc->sc_atapi_adapter._generic;
|
|
||||||
int s, error = 0;
|
|
||||||
|
|
||||||
s = splbio();
|
|
||||||
if (adapt->adapt_refcnt++ == 0 &&
|
|
||||||
adapt->adapt_enable != NULL) {
|
|
||||||
error = (*adapt->adapt_enable)(&wdc->sc_dev, 1);
|
|
||||||
if (error)
|
|
||||||
adapt->adapt_refcnt--;
|
|
||||||
}
|
|
||||||
splx(s);
|
|
||||||
return (error);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
wdc_delref(struct wdc_channel *chp)
|
|
||||||
{
|
|
||||||
struct wdc_softc *wdc = chp->ch_wdc;
|
|
||||||
struct scsipi_adapter *adapt = &wdc->sc_atapi_adapter._generic;
|
|
||||||
int s;
|
|
||||||
|
|
||||||
s = splbio();
|
|
||||||
if (adapt->adapt_refcnt-- == 1 &&
|
|
||||||
adapt->adapt_enable != NULL)
|
|
||||||
(void) (*adapt->adapt_enable)(&wdc->sc_dev, 0);
|
|
||||||
splx(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wdc_datain_pio(chp, flags, buf, len)
|
wdc_datain_pio(chp, flags, buf, len)
|
||||||
struct wdc_channel *chp;
|
struct wdc_channel *chp;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: wdcvar.h,v 1.70 2004/08/12 22:33:45 thorpej Exp $ */
|
/* $NetBSD: wdcvar.h,v 1.71 2004/08/12 22:39:41 thorpej Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
|
||||||
|
@ -221,9 +221,6 @@ void wdc_reset_channel(struct wdc_channel *, int);
|
||||||
|
|
||||||
int wdc_exec_command(struct ata_drive_datas *, struct ata_command*);
|
int wdc_exec_command(struct ata_drive_datas *, struct ata_command*);
|
||||||
|
|
||||||
int wdc_addref(struct wdc_channel *);
|
|
||||||
void wdc_delref(struct wdc_channel *);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ST506 spec says that if READY or SEEKCMPLT go off, then the read or write
|
* ST506 spec says that if READY or SEEKCMPLT go off, then the read or write
|
||||||
* command is aborted.
|
* command is aborted.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: wdc_pcmcia.c,v 1.88 2004/08/11 20:27:42 mycroft Exp $ */
|
/* $NetBSD: wdc_pcmcia.c,v 1.89 2004/08/12 22:39:41 thorpej Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.88 2004/08/11 20:27:42 mycroft Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.89 2004/08/12 22:39:41 thorpej Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/device.h>
|
#include <sys/device.h>
|
||||||
|
@ -291,7 +291,7 @@ wdc_pcmcia_attach(parent, self, aux)
|
||||||
sc->sc_wdcdev.sc_atapi_adapter._generic.adapt_refcnt = 1;
|
sc->sc_wdcdev.sc_atapi_adapter._generic.adapt_refcnt = 1;
|
||||||
|
|
||||||
wdcattach(&sc->wdc_channel);
|
wdcattach(&sc->wdc_channel);
|
||||||
wdc_delref(&sc->wdc_channel);
|
ata_delref(&sc->wdc_channel);
|
||||||
sc->sc_state = WDC_PCMCIA_ATTACHED;
|
sc->sc_state = WDC_PCMCIA_ATTACHED;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: atapi_wdc.c,v 1.81 2004/08/12 21:34:52 thorpej Exp $ */
|
/* $NetBSD: atapi_wdc.c,v 1.82 2004/08/12 22:39:41 thorpej Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2001 Manuel Bouyer.
|
* Copyright (c) 1998, 2001 Manuel Bouyer.
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.81 2004/08/12 21:34:52 thorpej Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.82 2004/08/12 22:39:41 thorpej Exp $");
|
||||||
|
|
||||||
#ifndef WDCDEBUG
|
#ifndef WDCDEBUG
|
||||||
#define WDCDEBUG
|
#define WDCDEBUG
|
||||||
|
@ -165,7 +165,7 @@ wdc_atapi_kill_pending(struct scsipi_periph *periph)
|
||||||
struct wdc_channel *chp =
|
struct wdc_channel *chp =
|
||||||
wdc->channels[periph->periph_channel->chan_channel];
|
wdc->channels[periph->periph_channel->chan_channel];
|
||||||
|
|
||||||
wdc_kill_pending(&chp->ch_drive[periph->periph_target]);
|
ata_kill_pending(&chp->ch_drive[periph->periph_target]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue