Pull more cleanups from OpenBSD/luna88k:

- remove unused declarations
- rename struct scsi_fmt_cdb to scsi_generic_cdb
This commit is contained in:
tsutsui 2014-01-03 07:17:19 +00:00
parent aafa26eec9
commit d28b149862
6 changed files with 21 additions and 222 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: samachdep.h,v 1.13 2014/01/03 06:37:13 tsutsui Exp $ */
/* $NetBSD: samachdep.h,v 1.14 2014/01/03 07:17:19 tsutsui Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
@ -84,10 +84,6 @@ void cninit(void);
int cngetc(void);
void cnputc(int);
/* devopen.c */
extern u_int opendev;
int atoi(char *);
/* disklabel.c */
extern u_char lbl_buff[];
int disklabel(int, char **);
@ -171,8 +167,8 @@ int romcngetc(dev_t);
void romcnputc(dev_t, int);
/* sc.c */
struct scsi_fmt_cdb;
int scsi_immed_command(int, int, int, struct scsi_fmt_cdb *, u_char *,
struct scsi_generic_cdb;
int scsi_immed_command(int, int, int, struct scsi_generic_cdb *, u_char *,
unsigned int);
int scsi_request_sense(int, int, int, u_char *, unsigned int);
int scsi_test_unit_rdy(int, int, int);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sc.c,v 1.7 2014/01/02 19:50:03 tsutsui Exp $ */
/* $NetBSD: sc.c,v 1.8 2014/01/03 07:17:19 tsutsui Exp $ */
/*
* Copyright (c) 1992 OMRON Corporation.
@ -453,7 +453,7 @@ scsi_request_sense(int ctlr, int slave, int unit, u_char *buf, unsigned int len)
}
int
scsi_immed_command(int ctlr, int slave, int unit, struct scsi_fmt_cdb *cdb,
scsi_immed_command(int ctlr, int slave, int unit, struct scsi_generic_cdb *cdb,
u_char *buf, unsigned int len)
{
int status;

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsi.c,v 1.3 2014/01/02 19:50:03 tsutsui Exp $ */
/* $NetBSD: scsi.c,v 1.4 2014/01/03 07:17:19 tsutsui Exp $ */
/*
* Copyright (c) 1992 OMRON Corporation.
@ -89,13 +89,13 @@ int scsi_device = 6;
u_char sensbuff[SENSBUFF]; /* 8以上は無意味である。 */
static struct scsi_inquiry inquirybuf;
static struct scsi_fmt_cdb inquiry = {
static struct scsi_generic_cdb inquiry = {
6,
{ CMD_INQUIRY, 0, 0, 0, sizeof(inquirybuf), 0 }
};
static u_long capacitybuf[2];
struct scsi_fmt_cdb capacity = {
struct scsi_generic_cdb capacity = {
10,
{ CMD_READ_CAPACITY, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
@ -187,7 +187,7 @@ scsi(int argc, char *argv[])
return(ST_NORMAL);
}
static struct scsi_fmt_cdb scsi_cdb = {
static struct scsi_generic_cdb scsi_cdb = {
10,
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
@ -195,7 +195,7 @@ static struct scsi_fmt_cdb scsi_cdb = {
int
scsi_read_raw(u_int target, u_int blk, u_int nblk, u_char *buff, u_int len)
{
struct scsi_fmt_cdb *cdb = &scsi_cdb;
struct scsi_generic_cdb *cdb = &scsi_cdb;
cdb->cdb[0] = CMD_READ_EXT;
@ -224,7 +224,7 @@ scsi_read(u_int blk, u_char *buff, u_int len)
int
scsi_write(u_int blk, u_char *buff, u_int len)
{
struct scsi_fmt_cdb *cdb = &scsi_cdb;
struct scsi_generic_cdb *cdb = &scsi_cdb;
cdb->cdb[0] = CMD_WRITE_EXT;

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsireg.h,v 1.2 2013/01/22 15:48:40 tsutsui Exp $ */
/* $NetBSD: scsireg.h,v 1.3 2014/01/03 07:17:19 tsutsui Exp $ */
/*
* Copyright (c) 1990, 1992, 1993
@ -259,204 +259,7 @@ struct scsi_inquiry {
char rev[4];
};
struct scsi_format_parms { /* physical BFI format */
u_short reserved;
u_short list_len;
struct defect {
unsigned cyl : 24;
unsigned head : 8;
long bytes_from_index;
} defect[127];
} format_parms;
struct scsi_reassign_parms {
u_short reserved;
u_short list_len; /* length in bytes of defects only */
struct new_defect {
unsigned lba; /* logical block address */
} new_defect[2];
} reassign_parms;
struct scsi_modesel_hdr {
u_char rsvd1;
u_char media_type;
u_char rsvd2;
u_char block_desc_len;
u_int density : 8;
u_int number_blocks :24;
u_int rsvd3 : 8;
u_int block_length :24;
};
struct scsi_modesense_hdr {
u_char len;
u_char media_type;
u_char wp : 1;
u_char rsvd1 : 7;
u_char block_desc_len;
u_int density : 8;
u_int number_blocks :24;
u_int rsvd2 : 8;
u_int block_length :24;
};
/*
* Mode Select / Mode sense "pages"
*/
/*
* Page One - Error Recovery Parameters
*/
struct scsi_err_recovery {
u_char page_savable : 1; /* save parameters */
u_char reserved : 1;
u_char page_code : 6; /* = 0x01 */
u_char page_length; /* = 6 */
u_char awre : 1; /* auto write realloc enabled */
u_char arre : 1; /* auto read realloc enabled */
u_char tb : 1; /* transfer block */
u_char rc : 1; /* read continuous */
u_char eec : 1; /* enable early correction */
u_char per : 1; /* post error */
u_char dte : 1; /* disable transfer on error */
u_char dcr : 1; /* disable correction */
u_char retry_count;
u_char correction_span;
u_char head_offset_count;
u_char strobe_offset_count;
u_char recovery_time_limit;
};
/*
* Page Two - Disconnect / Reconnect Control Parameters
*/
struct scsi_disco_reco {
u_char page_savable : 1; /* save parameters */
u_char rsvd : 1;
u_char page_code : 6; /* = 0x02 */
u_char page_length; /* = 10 */
u_char buffer_full_ratio; /* write, how full before reconnect? */
u_char buffer_empty_ratio; /* read, how full before reconnect? */
u_short bus_inactivity_limit; /* how much bus time for busy */
u_short disconnect_time_limit; /* min to remain disconnected */
u_short connect_time_limit; /* min to remain connected */
u_short reserved_1;
};
/*
* Page Three - Direct Access Device Format Parameters
*/
struct scsi_format {
u_char page_savable : 1; /* save parameters */
u_char rsvd : 1;
u_char page_code : 6; /* = 0x03 */
u_char page_length; /* = 22 */
u_short tracks_per_zone; /* Handling of Defects Fields */
u_short alt_sect_zone;
u_short alt_tracks_zone;
u_short alt_tracks_vol;
u_short sect_track; /* Track Format Field */
u_short data_sect; /* Sector Format Fields */
u_short interleave;
u_short track_skew_factor;
u_short cyl_skew_factor;
u_char ssec : 1; /* Drive Type Field */
u_char hsec : 1;
u_char rmb : 1;
u_char surf : 1;
u_char ins : 1;
u_char reserved_1 : 3;
u_char reserved_2;
u_char reserved_3;
u_char reserved_4;
};
/*
* Page Four - Rigid Disk Drive Geometry Parameters
*/
struct scsi_geometry {
u_char page_savable : 1; /* save parameters */
u_char rsvd : 1;
u_char page_code : 6; /* = 0x04 */
u_char page_length; /* = 18 */
u_char cyl_ub; /* number of cylinders */
u_char cyl_mb;
u_char cyl_lb;
u_char heads; /* number of heads */
u_char precomp_cyl_ub; /* cylinder to start precomp */
u_char precomp_cyl_mb;
u_char precomp_cyl_lb;
u_char current_cyl_ub; /* cyl to start reduced current */
u_char current_cyl_mb;
u_char current_cyl_lb;
u_short step_rate; /* drive step rate */
u_char landing_cyl_ub; /* landing zone cylinder */
u_char landing_cyl_mb;
u_char landing_cyl_lb;
u_char reserved_1;
u_char reserved_2;
u_char reserved_3;
};
/*
* Page 0x38 - Cache Control Parameters
*/
struct scsi_cache {
u_char page_savable : 1; /* save parameters */
u_char rsvd : 1;
u_char page_code : 6; /* = 0x38 */
u_char page_length; /* = 14 */
u_char rsvd_1 : 1;
u_char wie : 1; /* write index enable */
u_char rsvd_2 : 1;
u_char ce : 1; /* cache enable */
u_char table_size : 4;
u_char prefetch_threshold;
u_char maximum_threshold;
u_char maximumprefetch_multiplier;
u_char minimum_threshold;
u_char minimum_prefetch_multiplier;
u_char reserved[8];
};
/*
* Driver ioctl's for various scsi operations.
*/
#ifndef _IOCTL_
#if 0
#include <sys/ioctl.h>
#endif
#endif
/*
* Control for SCSI "format" mode.
*
* "Format" mode allows a privileged process to issue direct SCSI
* commands to a drive (it is intended primarily to allow on-line
* formatting). SDIOCSFORMAT with a non-zero arg will put the drive
* into format mode; a zero arg will take it out. When in format
* mode, only the process that issued the SDIOCFORMAT can read or
* write the drive.
*
* In format mode, process is expected to
* - do SDIOCSCSICOMMAND to supply cdb for next SCSI op
* - do read or write as appropriate for cdb
* - if i/o error, optionally do SDIOCSENSE to get completion
* status and sense data from last scsi operation.
*/
struct scsi_fmt_cdb {
struct scsi_generic_cdb {
int len; /* cdb length (in bytes) */
u_char cdb[28]; /* cdb to use on next read/write */
};
struct scsi_fmt_sense {
u_int status; /* completion status of last op */
u_char sense[28]; /* sense data (if any) from last op */
};
#define SDIOCSFORMAT _IOW('S', 0x1, int)
#define SDIOCGFORMAT _IOR('S', 0x2, int)
#define SDIOCSCSICOMMAND _IOW('S', 0x3, struct scsi_fmt_cdb)
#define SDIOCSENSE _IOR('S', 0x4, struct scsi_fmt_sense)

View File

@ -1,4 +1,4 @@
/* $NetBSD: sd.c,v 1.7 2014/01/03 03:25:25 tsutsui Exp $ */
/* $NetBSD: sd.c,v 1.8 2014/01/03 07:17:19 tsutsui Exp $ */
/*
* Copyright (c) 1992 OMRON Corporation.
@ -119,13 +119,13 @@ struct sd_devdata sd_devdata[NSD];
#define sdpart(x) (minor(x) & 0x7)
static struct scsi_inquiry inqbuf;
static struct scsi_fmt_cdb inq = {
static struct scsi_generic_cdb inq = {
6,
{ CMD_INQUIRY, 0, 0, 0, sizeof(inqbuf), 0 }
};
static u_long capbuf[2];
struct scsi_fmt_cdb cap = {
struct scsi_generic_cdb cap = {
10,
{ CMD_READ_CAPACITY, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
@ -292,12 +292,12 @@ sdclose(struct open_file *f)
return 0;
}
static struct scsi_fmt_cdb cdb_read = {
static struct scsi_generic_cdb cdb_read = {
10,
{ CMD_READ_EXT, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
static struct scsi_fmt_cdb cdb_write = {
static struct scsi_generic_cdb cdb_write = {
6,
{ CMD_WRITE_EXT, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
@ -312,7 +312,7 @@ sdstrategy(void *devdata, int func, daddr_t dblk, size_t size, void *v_buf,
int unit = sd->unit;
int part = sd->part;
struct sd_softc *sc = &sd_softc[unit];
struct scsi_fmt_cdb *cdb;
struct scsi_generic_cdb *cdb;
daddr_t blk;
u_int nblk = size >> sc->sc_bshift;
int stat, ctlr, slave;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_disksubr.c,v 1.2 2013/01/14 01:37:57 tsutsui Exp $ */
/* $NetBSD: ufs_disksubr.c,v 1.3 2014/01/03 07:17:19 tsutsui Exp $ */
/*
* Copyright (c) 1992 OMRON Corporation.
@ -94,7 +94,7 @@ readdisklabel(int ctlr, int id, struct disklabel *lp)
u_char *bp = lbl_buff;
struct disklabel *dlp;
char *msg = NULL;
static struct scsi_fmt_cdb cdb = {
static struct scsi_generic_cdb cdb = {
6,
{ CMD_READ, 0, 0, 0, 1, 0 }
};