USe more appropriate macro/struct names for READ/WRITE (6) and
READ/WRITE (10).
This commit is contained in:
parent
78e83f262c
commit
ce91ac7d6b
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: idesc.c,v 1.55 2004/03/28 18:59:39 mhitch Exp $ */
|
||||
/* $NetBSD: idesc.c,v 1.56 2004/12/07 23:07:31 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -93,7 +93,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: idesc.c,v 1.55 2004/03/28 18:59:39 mhitch Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: idesc.c,v 1.56 2004/12/07 23:07:31 thorpej Exp $");
|
||||
|
||||
/*
|
||||
* A4000 IDE interface, emulating a SCSI controller
|
||||
@ -1021,24 +1021,24 @@ ideicmd(struct idec_softc *dev, int target, void *cbuf, int clen, void *buf,
|
||||
dev->sc_stat[0] = 0;
|
||||
return (0);
|
||||
|
||||
case READ_BIG:
|
||||
case READ_10:
|
||||
lba = *((long *)((char *)cbuf + 2));
|
||||
nblks = *((u_short *)((char *)cbuf + 7));
|
||||
return (ideiread(ide, lba, buf, nblks));
|
||||
|
||||
case SCSI_READ_COMMAND:
|
||||
case SCSI_READ_6_COMMAND:
|
||||
lba = *((long *)cbuf) & 0x001fffff;
|
||||
nblks = *((u_char *)((char *)cbuf + 4));
|
||||
if (nblks == 0)
|
||||
nblks = 256;
|
||||
return (ideiread(ide, lba, buf, nblks));
|
||||
|
||||
case WRITE_BIG:
|
||||
case WRITE_10:
|
||||
lba = *((long *)((char *)cbuf + 2));
|
||||
nblks = *((u_short *)((char *)cbuf + 7));
|
||||
return (ideiwrite(ide, lba, buf, nblks));
|
||||
|
||||
case SCSI_WRITE_COMMAND:
|
||||
case SCSI_WRITE_6_COMMAND:
|
||||
lba = *((long *)cbuf) & 0x001fffff;
|
||||
nblks = *((u_char *)((char *)cbuf + 4));
|
||||
if (nblks == 0)
|
||||
@ -1131,22 +1131,22 @@ idego(struct idec_softc *dev, struct scsipi_xfer *xs)
|
||||
ide->sc_flags &= ~IDEF_SENSE;
|
||||
return (idestart(dev));
|
||||
}
|
||||
if (xs->cmd->opcode != SCSI_READ_COMMAND && xs->cmd->opcode != READ_BIG &&
|
||||
xs->cmd->opcode != SCSI_WRITE_COMMAND && xs->cmd->opcode != WRITE_BIG) {
|
||||
if (xs->cmd->opcode != SCSI_READ_6_COMMAND && xs->cmd->opcode != READ_10 &&
|
||||
xs->cmd->opcode != SCSI_WRITE_6_COMMAND && xs->cmd->opcode != WRITE_10) {
|
||||
ideicmd (dev, xs->xs_periph->periph_target, xs->cmd, xs->cmdlen,
|
||||
xs->data, xs->datalen);
|
||||
return (1);
|
||||
}
|
||||
switch (xs->cmd->opcode) {
|
||||
case SCSI_READ_COMMAND:
|
||||
case SCSI_WRITE_COMMAND:
|
||||
case SCSI_READ_6_COMMAND:
|
||||
case SCSI_WRITE_6_COMMAND:
|
||||
lba = *((long *)xs->cmd) & 0x001fffff;
|
||||
nblks = xs->cmd->bytes[3];
|
||||
if (nblks == 0)
|
||||
nblks = 256;
|
||||
break;
|
||||
case READ_BIG:
|
||||
case WRITE_BIG:
|
||||
case READ_10:
|
||||
case WRITE_10:
|
||||
lba = *((long *)&xs->cmd->bytes[1]);
|
||||
nblks = *((short *)&xs->cmd->bytes[6]);
|
||||
break;
|
||||
@ -1157,7 +1157,7 @@ idego(struct idec_softc *dev, struct scsipi_xfer *xs)
|
||||
ide->sc_blkcnt = nblks;
|
||||
ide->sc_skip = ide->sc_mskip = 0;
|
||||
dev->sc_flags &= ~IDECF_READ;
|
||||
if (xs->cmd->opcode == SCSI_READ_COMMAND || xs->cmd->opcode == READ_BIG)
|
||||
if (xs->cmd->opcode == SCSI_READ_6_COMMAND || xs->cmd->opcode == READ_10)
|
||||
dev->sc_flags |= IDECF_READ;
|
||||
dev->sc_cur = ide;
|
||||
return (idestart (dev));
|
||||
@ -1316,7 +1316,7 @@ int ide_atapi_start(struct idec_softc *dev)
|
||||
int i;
|
||||
u_short *bf;
|
||||
union {
|
||||
struct scsipi_rw_big rw_big;
|
||||
struct scsipi_rw_10 rw_big;
|
||||
struct scsipi_mode_sense_big md_big;
|
||||
} cmd;
|
||||
|
||||
@ -1336,8 +1336,8 @@ int ide_atapi_start(struct idec_softc *dev)
|
||||
|
||||
bf = (u_short *)xs->cmd;
|
||||
switch (xs->cmd->opcode) {
|
||||
case SCSI_READ_COMMAND:
|
||||
case SCSI_WRITE_COMMAND:
|
||||
case SCSI_READ_6_COMMAND:
|
||||
case SCSI_WRITE_6_COMMAND:
|
||||
bzero((char *)&cmd, sizeof(cmd.rw_big));
|
||||
cmd.rw_big.opcode = xs->cmd->opcode | 0x20;
|
||||
cmd.rw_big.addr[3] = xs->cmd->bytes[2];
|
||||
@ -1451,7 +1451,7 @@ ide_atapi_intr(struct idec_softc *dev)
|
||||
int ire;
|
||||
int retries = 0;
|
||||
union {
|
||||
struct scsipi_rw_big rw_big;
|
||||
struct scsipi_rw_10 rw_big;
|
||||
struct scsipi_mode_sense_big md_big;
|
||||
} cmd;
|
||||
|
||||
@ -1489,8 +1489,8 @@ again:
|
||||
|
||||
bf = (u_short *)xs->cmd;
|
||||
switch (xs->cmd->opcode) {
|
||||
case SCSI_READ_COMMAND:
|
||||
case SCSI_WRITE_COMMAND:
|
||||
case SCSI_READ_6_COMMAND:
|
||||
case SCSI_WRITE_6_COMMAND:
|
||||
bzero((char *)&cmd, sizeof(cmd.rw_big));
|
||||
cmd.rw_big.opcode = xs->cmd->opcode | 0x20;
|
||||
cmd.rw_big.addr[3] = xs->cmd->bytes[2];
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sd.c,v 1.4 2003/10/27 16:48:08 cl Exp $ */
|
||||
/* $NetBSD: sd.c,v 1.5 2004/12/07 23:07:31 thorpej Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1994 Rolf Grossmann
|
||||
* All rights reserved.
|
||||
@ -240,7 +240,7 @@ sdstrategy(struct sd_softc *ss, int rw, daddr_t dblk, size_t size,
|
||||
void *buf, size_t *rsize)
|
||||
{
|
||||
u_long blk = dblk + ss->sc_pinfo.offset[ss->sc_part];
|
||||
struct scsipi_rw_big cdb;
|
||||
struct scsipi_rw_10 cdb;
|
||||
int error;
|
||||
|
||||
if (size == 0)
|
||||
@ -267,7 +267,7 @@ sdstrategy(struct sd_softc *ss, int rw, daddr_t dblk, size_t size,
|
||||
blk, tsize, nblks, ss->sc_dev_bsize));
|
||||
|
||||
bzero(&cdb, sizeof(cdb));
|
||||
cdb.opcode = READ_BIG;
|
||||
cdb.opcode = READ_10;
|
||||
cdb.addr[0] = (blk & 0xff000000) >> 24;
|
||||
cdb.addr[1] = (blk & 0xff0000) >> 16;
|
||||
cdb.addr[2] = (blk & 0xff00) >> 8;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sii.c,v 1.49 2003/08/07 16:29:10 agc Exp $ */
|
||||
/* $NetBSD: sii.c,v 1.50 2004/12/07 23:07:31 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sii.c,v 1.49 2003/08/07 16:29:10 agc Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sii.c,v 1.50 2004/12/07 23:07:31 thorpej Exp $");
|
||||
|
||||
#include "sii.h"
|
||||
/*
|
||||
@ -399,8 +399,8 @@ sii_StartCmd(sc, target)
|
||||
state->dmaDataPhase);
|
||||
}
|
||||
sii_debug_cmd = scsicmd->cmd[0];
|
||||
if (scsicmd->cmd[0] == READ_BIG ||
|
||||
scsicmd->cmd[0] == WRITE_BIG) {
|
||||
if (scsicmd->cmd[0] == READ_10 ||
|
||||
scsicmd->cmd[0] == WRITE_10) {
|
||||
sii_debug_bn = (scsicmd->cmd[2] << 24) |
|
||||
(scsicmd->cmd[3] << 16) |
|
||||
(scsicmd->cmd[4] << 8) |
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cd.c,v 1.211 2004/10/28 07:07:45 yamt Exp $ */
|
||||
/* $NetBSD: cd.c,v 1.212 2004/12/07 23:07:31 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2001, 2003, 2004 The NetBSD Foundation, Inc.
|
||||
@ -54,7 +54,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.211 2004/10/28 07:07:45 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.212 2004/12/07 23:07:31 thorpej Exp $");
|
||||
|
||||
#include "rnd.h"
|
||||
|
||||
@ -739,8 +739,8 @@ cdstart(struct scsipi_periph *periph)
|
||||
{
|
||||
struct cd_softc *cd = (void *)periph->periph_dev;
|
||||
struct buf *bp = 0;
|
||||
struct scsipi_rw_big cmd_big;
|
||||
struct scsi_rw cmd_small;
|
||||
struct scsipi_rw_10 cmd_big;
|
||||
struct scsi_rw_6 cmd_small;
|
||||
struct scsipi_generic *cmdp;
|
||||
struct scsipi_xfer *xs;
|
||||
int flags, nblks, cmdlen, error;
|
||||
@ -803,7 +803,7 @@ cdstart(struct scsipi_periph *periph)
|
||||
*/
|
||||
memset(&cmd_small, 0, sizeof(cmd_small));
|
||||
cmd_small.opcode = (bp->b_flags & B_READ) ?
|
||||
SCSI_READ_COMMAND : SCSI_WRITE_COMMAND;
|
||||
SCSI_READ_6_COMMAND : SCSI_WRITE_6_COMMAND;
|
||||
_lto3b(bp->b_rawblkno, cmd_small.addr);
|
||||
cmd_small.length = nblks & 0xff;
|
||||
cmdlen = sizeof(cmd_small);
|
||||
@ -814,7 +814,7 @@ cdstart(struct scsipi_periph *periph)
|
||||
*/
|
||||
memset(&cmd_big, 0, sizeof(cmd_big));
|
||||
cmd_big.opcode = (bp->b_flags & B_READ) ?
|
||||
READ_BIG : WRITE_BIG;
|
||||
READ_10 : WRITE_10;
|
||||
_lto4b(bp->b_rawblkno, cmd_big.addr);
|
||||
_lto2b(nblks, cmd_big.length);
|
||||
cmdlen = sizeof(cmd_big);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: scsi_disk.h,v 1.24 2003/09/05 09:00:08 mycroft Exp $ */
|
||||
/* $NetBSD: scsi_disk.h,v 1.25 2004/12/07 23:07:31 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* SCSI-specific interface description
|
||||
@ -159,9 +159,9 @@ struct scsi_rezero_unit {
|
||||
u_int8_t control;
|
||||
};
|
||||
|
||||
#define SCSI_READ_COMMAND 0x08
|
||||
#define SCSI_WRITE_COMMAND 0x0a
|
||||
struct scsi_rw {
|
||||
#define SCSI_READ_6_COMMAND 0x08
|
||||
#define SCSI_WRITE_6_COMMAND 0x0a
|
||||
struct scsi_rw_6 {
|
||||
u_int8_t opcode;
|
||||
u_int8_t addr[3];
|
||||
#define SRW_TOPADDR 0x1F /* only 5 bits here */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: scsi_scanner.h,v 1.7 2001/11/19 17:18:08 soren Exp $ */
|
||||
/* $NetBSD: scsi_scanner.h,v 1.8 2004/12/07 23:07:31 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Kenneth Stailey. All rights reserved.
|
||||
@ -36,8 +36,8 @@
|
||||
|
||||
/* SCSI scanner commands */
|
||||
#define GET_IMAGE_STATUS 0x0f
|
||||
#define READ_BIG 0x28
|
||||
#define WRITE_BIG 0x2a
|
||||
#define READ_10 0x28
|
||||
#define WRITE_10 0x2a
|
||||
#define OBJECT_POSITION 0x31
|
||||
#define GET_BUFFER_STATUS 0x34
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: scsipi_disk.h,v 1.11 2004/12/04 19:02:25 thorpej Exp $ */
|
||||
/* $NetBSD: scsipi_disk.h,v 1.12 2004/12/07 23:07:31 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* SCSI and SCSI-like interfaces description
|
||||
@ -56,9 +56,9 @@
|
||||
* SCSI command format
|
||||
*/
|
||||
|
||||
#define READ_BIG 0x28
|
||||
#define WRITE_BIG 0x2a
|
||||
struct scsipi_rw_big {
|
||||
#define READ_10 0x28
|
||||
#define WRITE_10 0x2a
|
||||
struct scsipi_rw_10 {
|
||||
u_int8_t opcode;
|
||||
u_int8_t byte2;
|
||||
#define SRWB_RELADDR 0x01 /* obsolete */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sd.c,v 1.230 2004/12/04 19:02:26 thorpej Exp $ */
|
||||
/* $NetBSD: sd.c,v 1.231 2004/12/07 23:07:31 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
|
||||
@ -54,7 +54,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.230 2004/12/04 19:02:26 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.231 2004/12/07 23:07:31 thorpej Exp $");
|
||||
|
||||
#include "opt_scsi.h"
|
||||
#include "rnd.h"
|
||||
@ -774,8 +774,8 @@ sdstart(struct scsipi_periph *periph)
|
||||
struct disklabel *lp = sd->sc_dk.dk_label;
|
||||
struct buf *bp = 0;
|
||||
struct scsipi_rw_16 cmd16;
|
||||
struct scsipi_rw_big cmd_big;
|
||||
struct scsi_rw cmd_small;
|
||||
struct scsipi_rw_10 cmd_big;
|
||||
struct scsi_rw_6 cmd_small;
|
||||
struct scsipi_generic *cmdp;
|
||||
struct scsipi_xfer *xs;
|
||||
int nblks, cmdlen, error, flags;
|
||||
@ -839,7 +839,7 @@ sdstart(struct scsipi_periph *periph)
|
||||
/* 6-byte CDB */
|
||||
memset(&cmd_small, 0, sizeof(cmd_small));
|
||||
cmd_small.opcode = (bp->b_flags & B_READ) ?
|
||||
SCSI_READ_COMMAND : SCSI_WRITE_COMMAND;
|
||||
SCSI_READ_6_COMMAND : SCSI_WRITE_6_COMMAND;
|
||||
_lto3b(bp->b_rawblkno, cmd_small.addr);
|
||||
cmd_small.length = nblks & 0xff;
|
||||
cmdlen = sizeof(cmd_small);
|
||||
@ -848,7 +848,7 @@ sdstart(struct scsipi_periph *periph)
|
||||
/* 10-byte CDB */
|
||||
memset(&cmd_big, 0, sizeof(cmd_big));
|
||||
cmd_big.opcode = (bp->b_flags & B_READ) ?
|
||||
READ_BIG : WRITE_BIG;
|
||||
READ_10 : WRITE_10;
|
||||
_lto4b(bp->b_rawblkno, cmd_big.addr);
|
||||
_lto2b(nblks, cmd_big.length);
|
||||
cmdlen = sizeof(cmd_big);
|
||||
@ -1468,7 +1468,7 @@ sddump(dev_t dev, daddr_t blkno, caddr_t va, size_t size)
|
||||
int sectoff; /* sector offset of partition */
|
||||
int totwrt; /* total number of sectors left to write */
|
||||
int nwrt; /* current number of sectors to write */
|
||||
struct scsipi_rw_big cmd; /* write command */
|
||||
struct scsipi_rw_10 cmd; /* write command */
|
||||
struct scsipi_xfer *xs; /* ... convenience */
|
||||
struct scsipi_periph *periph;
|
||||
struct scsipi_channel *chan;
|
||||
@ -1524,7 +1524,7 @@ sddump(dev_t dev, daddr_t blkno, caddr_t va, size_t size)
|
||||
* Fill out the scsi command
|
||||
*/
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
cmd.opcode = WRITE_BIG;
|
||||
cmd.opcode = WRITE_10;
|
||||
_lto4b(blkno, cmd.addr);
|
||||
_lto2b(nwrt, cmd.length);
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user