-/* $OpenBSD: wdc.c,v 1.105 2009/11/23 23:48:37 deraadt Exp $ */
+/* $OpenBSD: wdc.c,v 1.106 2010/07/22 21:52:17 jsg Exp $ */
/* $NetBSD: wdc.c,v 1.68 1999/06/23 19:00:17 bouyer Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
#endif /* WDCDEBUG */
u_int8_t
-wdc_default_read_reg(chp, reg)
- struct channel_softc *chp;
- enum wdc_regs reg;
+wdc_default_read_reg(struct channel_softc *chp, enum wdc_regs reg)
{
#ifdef DIAGNOSTIC
if (reg & _WDC_WRONLY) {
}
void
-wdc_default_write_reg(chp, reg, val)
- struct channel_softc *chp;
- enum wdc_regs reg;
- u_int8_t val;
+wdc_default_write_reg(struct channel_softc *chp, enum wdc_regs reg, u_int8_t val)
{
#ifdef DIAGNOSTIC
if (reg & _WDC_RDONLY) {
}
void
-wdc_default_lba48_write_reg(chp, reg, val)
- struct channel_softc *chp;
- enum wdc_regs reg;
- u_int16_t val;
+wdc_default_lba48_write_reg(struct channel_softc *chp, enum wdc_regs reg,
+ u_int16_t val)
{
/* All registers are two byte deep FIFOs. */
CHP_WRITE_REG(chp, reg, val >> 8);
}
void
-wdc_default_read_raw_multi_2(chp, data, nbytes)
- struct channel_softc *chp;
- void *data;
- unsigned int nbytes;
+wdc_default_read_raw_multi_2(struct channel_softc *chp, void *data,
+ unsigned int nbytes)
{
if (data == NULL) {
unsigned int i;
void
-wdc_default_write_raw_multi_2(chp, data, nbytes)
- struct channel_softc *chp;
- void *data;
- unsigned int nbytes;
+wdc_default_write_raw_multi_2(struct channel_softc *chp, void *data,
+ unsigned int nbytes)
{
if (data == NULL) {
unsigned int i;
void
-wdc_default_write_raw_multi_4(chp, data, nbytes)
- struct channel_softc *chp;
- void *data;
- unsigned int nbytes;
+wdc_default_write_raw_multi_4(struct channel_softc *chp, void *data,
+ unsigned int nbytes)
{
if (data == NULL) {
unsigned int i;
void
-wdc_default_read_raw_multi_4(chp, data, nbytes)
- struct channel_softc *chp;
- void *data;
- unsigned int nbytes;
+wdc_default_read_raw_multi_4(struct channel_softc *chp, void *data,
+ unsigned int nbytes)
{
if (data == NULL) {
unsigned int i;
data, nbytes);
}
-
int
-wdprint(aux, pnp)
- void *aux;
- const char *pnp;
+wdprint(void *aux, const char *pnp)
{
struct ata_atapi_attach *aa_link = aux;
if (pnp)
}
void
-wdc_disable_intr(chp)
- struct channel_softc *chp;
+wdc_disable_intr(struct channel_softc *chp)
{
CHP_WRITE_REG(chp, wdr_ctlr, WDCTL_IDS);
}
void
-wdc_enable_intr(chp)
- struct channel_softc *chp;
+wdc_enable_intr(struct channel_softc *chp)
{
CHP_WRITE_REG(chp, wdr_ctlr, WDCTL_4BIT);
}
}
int
-wdc_floating_bus(chp, drive)
- struct channel_softc *chp;
- int drive;
-
+wdc_floating_bus(struct channel_softc *chp, int drive)
{
u_int8_t cumulative_status, status;
int iter;
return 0;
}
-
int
-wdc_preata_drive(chp, drive)
- struct channel_softc *chp;
- int drive;
-
+wdc_preata_drive(struct channel_softc *chp, int drive)
{
if (wdc_floating_bus(chp, drive)) {
WDCDEBUG_PRINT(("%s:%d:%d: floating bus detected\n",
}
int
-wdc_ata_present(chp, drive)
- struct channel_softc *chp;
- int drive;
+wdc_ata_present(struct channel_softc *chp, int drive)
{
int time_to_done;
int retry_cnt = 0;
*/
int
-wdcprobe(chp)
- struct channel_softc *chp;
+wdcprobe(struct channel_softc *chp)
{
u_int8_t st0, st1, sc, sn, cl, ch;
u_int8_t ret_value = 0x03;
* Call activate routine of underlying devices.
*/
int
-wdcactivate(self, act)
- struct device *self;
- int act;
+wdcactivate(struct device *self, int act)
{
int error = 0;
int s;
}
void
-wdcattach(chp)
- struct channel_softc *chp;
+wdcattach(struct channel_softc *chp)
{
int channel_flags, ctrl_flags, i;
struct ata_atapi_attach aa_link;
* are shared.
*/
void
-wdcstart(chp)
- struct channel_softc *chp;
+wdcstart(struct channel_softc *chp)
{
struct wdc_xfer *xfer;
}
int
-wdcdetach(chp, flags)
- struct channel_softc *chp;
- int flags;
+wdcdetach(struct channel_softc *chp, int flags)
{
int s, rv;
* the next chunk if so.
*/
int
-wdcintr(arg)
- void *arg;
+wdcintr(void *arg)
{
struct channel_softc *chp = arg;
struct wdc_xfer *xfer;
/* Put all disk in RESET state */
void
-wdc_reset_channel(drvp)
- struct ata_drive_datas *drvp;
+wdc_reset_channel(struct ata_drive_datas *drvp)
{
struct channel_softc *chp = drvp->chnl_softc;
int drive;
}
int
-wdcreset(chp, verb)
- struct channel_softc *chp;
- int verb;
+wdcreset(struct channel_softc *chp, int verb)
{
int drv_mask1, drv_mask2;
}
int
-__wdcwait_reset(chp, drv_mask)
- struct channel_softc *chp;
- int drv_mask;
+__wdcwait_reset(struct channel_softc *chp, int drv_mask)
{
int timeout;
u_int8_t st0, er0, st1, er1;
* return -1 for a timeout after "timeout" ms.
*/
int
-wdc_wait_for_status(chp, mask, bits, timeout)
- struct channel_softc *chp;
- int mask, bits, timeout;
+wdc_wait_for_status(struct channel_softc *chp, int mask, int bits, int timeout)
{
u_char status;
int time = 0;
* Busy-wait for DMA to complete
*/
int
-wdc_dmawait(chp, xfer, timeout)
- struct channel_softc *chp;
- struct wdc_xfer *xfer;
- int timeout;
+wdc_dmawait(struct channel_softc *chp, struct wdc_xfer *xfer, int timeout)
{
int time;
for (time = 0; time < timeout * 1000 / WDCDELAY; time++) {
}
void
-wdctimeout(arg)
- void *arg;
+wdctimeout(void *arg)
{
struct channel_softc *chp = (struct channel_softc *)arg;
struct wdc_xfer *xfer;
* XXX this should be a controller-indep function
*/
void
-wdc_probe_caps(drvp, params)
- struct ata_drive_datas *drvp;
- struct ataparams *params;
+wdc_probe_caps(struct ata_drive_datas *drvp, struct ataparams *params)
{
struct channel_softc *chp = drvp->chnl_softc;
struct wdc_softc *wdc = chp->wdc;
}
void
-wdc_output_bytes(drvp, bytes, buflen)
- struct ata_drive_datas *drvp;
- void *bytes;
- unsigned int buflen;
+wdc_output_bytes(struct ata_drive_datas *drvp, void *bytes, unsigned int buflen)
{
struct channel_softc *chp = drvp->chnl_softc;
unsigned int off = 0;
}
void
-wdc_input_bytes(drvp, bytes, buflen)
- struct ata_drive_datas *drvp;
- void *bytes;
- unsigned int buflen;
+wdc_input_bytes(struct ata_drive_datas *drvp, void *bytes, unsigned int buflen)
{
struct channel_softc *chp = drvp->chnl_softc;
unsigned int off = 0;
}
void
-wdc_print_caps(drvp)
- struct ata_drive_datas *drvp;
+wdc_print_caps(struct ata_drive_datas *drvp)
{
/* This is actually a lie until we fix the _probe_caps
algorithm. Don't print out lies */
}
void
-wdc_print_current_modes(chp)
- struct channel_softc *chp;
+wdc_print_current_modes(struct channel_softc *chp)
{
int drive;
struct ata_drive_datas *drvp;
* downgrade was possible, 0 otherwise.
*/
int
-wdc_downgrade_mode(drvp)
- struct ata_drive_datas *drvp;
+wdc_downgrade_mode(struct ata_drive_datas *drvp)
{
struct channel_softc *chp = drvp->chnl_softc;
struct wdc_softc *wdc = chp->wdc;
}
int
-wdc_exec_command(drvp, wdc_c)
- struct ata_drive_datas *drvp;
- struct wdc_command *wdc_c;
+wdc_exec_command(struct ata_drive_datas *drvp, struct wdc_command *wdc_c)
{
struct channel_softc *chp = drvp->chnl_softc;
struct wdc_xfer *xfer;
}
void
-__wdccommand_start(chp, xfer)
- struct channel_softc *chp;
- struct wdc_xfer *xfer;
+__wdccommand_start(struct channel_softc *chp, struct wdc_xfer *xfer)
{
int drive = xfer->drive;
struct wdc_command *wdc_c = xfer->cmd;
}
int
-__wdccommand_intr(chp, xfer, irq)
- struct channel_softc *chp;
- struct wdc_xfer *xfer;
- int irq;
+__wdccommand_intr(struct channel_softc *chp, struct wdc_xfer *xfer, int irq)
{
struct ata_drive_datas *drvp = &chp->ch_drive[xfer->drive];
struct wdc_command *wdc_c = xfer->cmd;
}
void
-__wdccommand_done(chp, xfer)
- struct channel_softc *chp;
- struct wdc_xfer *xfer;
+__wdccommand_done(struct channel_softc *chp, struct wdc_xfer *xfer)
{
struct wdc_command *wdc_c = xfer->cmd;
* Assumes interrupts are blocked.
*/
void
-wdccommand(chp, drive, command, cylin, head, sector, count, precomp)
- struct channel_softc *chp;
- u_int8_t drive;
- u_int8_t command;
- u_int16_t cylin;
- u_int8_t head, sector, count, precomp;
+wdccommand(struct channel_softc *chp, u_int8_t drive, u_int8_t command,
+ u_int16_t cylin, u_int8_t head, u_int8_t sector, u_int8_t count,
+ u_int8_t precomp)
{
WDCDEBUG_PRINT(("wdccommand %s:%d:%d: command=0x%x cylin=%d head=%d "
"sector=%d count=%d precomp=%d\n", chp->wdc->sc_dev.dv_xname,
* Assumes interrupts are blocked.
*/
void
-wdccommandext(chp, drive, command, blkno, count)
- struct channel_softc *chp;
- u_int8_t drive;
- u_int8_t command;
- u_int64_t blkno;
- u_int16_t count;
+wdccommandext(struct channel_softc *chp, u_int8_t drive, u_int8_t command,
+ u_int64_t blkno, u_int16_t count)
{
WDCDEBUG_PRINT(("wdccommandext %s:%d:%d: command=0x%x blkno=%llu "
"count=%d\n", chp->wdc->sc_dev.dv_xname,
* tested by the caller.
*/
void
-wdccommandshort(chp, drive, command)
- struct channel_softc *chp;
- int drive;
- int command;
+wdccommandshort(struct channel_softc *chp, int drive, int command)
{
WDCDEBUG_PRINT(("wdccommandshort %s:%d:%d command 0x%x\n",
/* Add a command to the queue and start controller. Must be called at splbio */
void
-wdc_exec_xfer(chp, xfer)
- struct channel_softc *chp;
- struct wdc_xfer *xfer;
+wdc_exec_xfer(struct channel_softc *chp, struct wdc_xfer *xfer)
{
WDCDEBUG_PRINT(("wdc_exec_xfer %p flags 0x%x channel %d drive %d\n",
xfer, xfer->c_flags, chp->channel, xfer->drive), DEBUG_XFERS);
}
struct wdc_xfer *
-wdc_get_xfer(flags)
- int flags;
+wdc_get_xfer(int flags)
{
struct wdc_xfer *xfer;
int s;
}
void
-wdc_free_xfer(chp, xfer)
- struct channel_softc *chp;
- struct wdc_xfer *xfer;
+wdc_free_xfer(struct channel_softc *chp, struct wdc_xfer *xfer)
{
struct wdc_softc *wdc = chp->wdc;
int s;
* Must be called at splbio().
*/
void
-wdc_kill_pending(chp)
- struct channel_softc *chp;
+wdc_kill_pending(struct channel_softc *chp)
{
struct wdc_xfer *xfer;
}
void
-__wdcerror(chp, msg)
- struct channel_softc *chp;
- char *msg;
+__wdcerror(struct channel_softc *chp, char *msg)
{
struct wdc_xfer *xfer = TAILQ_FIRST(&chp->ch_queue->sc_xfer);
if (xfer == NULL)
* the bit bucket
*/
void
-wdcbit_bucket(chp, size)
- struct channel_softc *chp;
- int size;
+wdcbit_bucket(struct channel_softc *chp, int size)
{
CHP_READ_RAW_MULTI_2(chp, NULL, size);
}
* scsipi_ioctl.c
*/
struct wdc_ioctl *
-wdc_ioctl_get()
+wdc_ioctl_get(void)
{
struct wdc_ioctl *wi;
int s;
*/
void
-wdc_ioctl_free(wi)
- struct wdc_ioctl *wi;
+wdc_ioctl_free(struct wdc_ioctl *wi)
{
int s;
*/
struct wdc_ioctl *
-wdc_ioctl_find(bp)
- struct buf *bp;
+wdc_ioctl_find(struct buf *bp)
{
struct wdc_ioctl *wi;
int s;
*/
void
-wdc_ioctl_strategy(bp)
- struct buf *bp;
+wdc_ioctl_strategy(struct buf *bp)
{
struct wdc_ioctl *wi;
struct wdc_command wdc_c;
}
int
-wdc_ioctl(drvp, xfer, addr, flag, p)
- struct ata_drive_datas *drvp;
- u_long xfer;
- caddr_t addr;
- int flag;
- struct proc *p;
+wdc_ioctl(struct ata_drive_datas *drvp, u_long xfer, caddr_t addr, int flag,
+ struct proc *p)
{
int error = 0;