View | Details | Raw Unified | Return to bug 36845
Collapse All | Expand All

(-)sys/cam/scsi/scsi_cd.c (+51 lines)
Lines 56-61 Link Here
56
#include <sys/disk.h>
56
#include <sys/disk.h>
57
#include <sys/malloc.h>
57
#include <sys/malloc.h>
58
#include <sys/cdio.h>
58
#include <sys/cdio.h>
59
#include <sys/cdrio.h>
59
#include <sys/dvdio.h>
60
#include <sys/dvdio.h>
60
#include <sys/devicestat.h>
61
#include <sys/devicestat.h>
61
#include <sys/sysctl.h>
62
#include <sys/sysctl.h>
Lines 231-236 Link Here
231
static	int		cdpause(struct cam_periph *periph, u_int32_t go);
232
static	int		cdpause(struct cam_periph *periph, u_int32_t go);
232
static	int		cdstopunit(struct cam_periph *periph, u_int32_t eject);
233
static	int		cdstopunit(struct cam_periph *periph, u_int32_t eject);
233
static	int		cdstartunit(struct cam_periph *periph);
234
static	int		cdstartunit(struct cam_periph *periph);
235
static	int		cdsetspeed(struct cam_periph *periph,
236
				   u_int16_t rdspeed, u_int16_t wrspeed);
234
static	int		cdreportkey(struct cam_periph *periph,
237
static	int		cdreportkey(struct cam_periph *periph,
235
				    struct dvd_authinfo *authinfo);
238
				    struct dvd_authinfo *authinfo);
236
static	int		cdsendkey(struct cam_periph *periph,
239
static	int		cdsendkey(struct cam_periph *periph,
Lines 2427-2432 Link Here
2427
		/* return (cd_reset(periph)); */
2430
		/* return (cd_reset(periph)); */
2428
		error = ENOTTY;
2431
		error = ENOTTY;
2429
		break;
2432
		break;
2433
	case CDRIOCREADSPEED:
2434
		error = cdsetspeed(periph, *(u_int16_t *)addr, -1);
2435
		break;
2436
	case CDRIOCWRITESPEED:
2437
		error = cdsetspeed(periph, -1, *(u_int16_t *)addr);
2438
		break;
2430
	case DVDIOCSENDKEY:
2439
	case DVDIOCSENDKEY:
2431
	case DVDIOCREPORTKEY: {
2440
	case DVDIOCREPORTKEY: {
2432
		struct dvd_authinfo *authinfo;
2441
		struct dvd_authinfo *authinfo;
Lines 3066-3071 Link Here
3066
			/* immediate */ FALSE,
3075
			/* immediate */ FALSE,
3067
			/* sense_len */ SSD_FULL_SIZE,
3076
			/* sense_len */ SSD_FULL_SIZE,
3068
			/* timeout */ 50000);
3077
			/* timeout */ 50000);
3078
3079
	error = cdrunccb(ccb, cderror, /*cam_flags*/CAM_RETRY_SELTO,
3080
			 /*sense_flags*/SF_RETRY_UA);
3081
3082
	xpt_release_ccb(ccb);
3083
3084
	return(error);
3085
}
3086
3087
static int
3088
cdsetspeed(struct cam_periph *periph, u_int16_t rdspeed, u_int16_t wrspeed)
3089
{
3090
	struct scsi_set_speed *scsi_cmd;
3091
	struct ccb_scsiio *csio;
3092
	union ccb *ccb;
3093
	int error;
3094
3095
	error = 0;
3096
3097
	ccb = cdgetccb(periph, /* priority */ 1);
3098
3099
	csio = &ccb->csio;
3100
3101
	cam_fill_csio(csio, 
3102
		      /* retries */ 1, 
3103
		      /* cbfcnp */ cddone, 
3104
		      /* flags */ CAM_DIR_NONE,
3105
		      /* tag_action */ MSG_SIMPLE_Q_TAG,
3106
		      /* data_ptr */ NULL,
3107
		      /* dxfer_len */ 0,
3108
		      /* sense_len */ SSD_FULL_SIZE,
3109
		      sizeof(struct scsi_set_speed),
3110
 		      /* timeout */ 50000);
3111
3112
	scsi_cmd = (struct scsi_set_speed *)&csio->cdb_io.cdb_bytes;
3113
	bzero (scsi_cmd, sizeof(*scsi_cmd));
3114
3115
	scsi_cmd->op_code = SET_CD_SPEED;
3116
	scsi_cmd->readspeed[0]=rdspeed >> 8 & 0xff;
3117
	scsi_cmd->readspeed[1]=rdspeed & 0xff;
3118
	scsi_cmd->writespeed[0]=wrspeed >> 8 & 0xff;
3119
	scsi_cmd->writespeed[1]=wrspeed & 0xff;
3069
3120
3070
	error = cdrunccb(ccb, cderror, /*cam_flags*/CAM_RETRY_SELTO,
3121
	error = cdrunccb(ccb, cderror, /*cam_flags*/CAM_RETRY_SELTO,
3071
			 /*sense_flags*/SF_RETRY_UA);
3122
			 /*sense_flags*/SF_RETRY_UA);
(-)sys/cam/scsi/scsi_cd.h (+11 lines)
Lines 169-174 Link Here
169
	u_int8_t control;
169
	u_int8_t control;
170
};
170
};
171
171
172
struct scsi_set_speed
173
{
174
	u_int8_t op_code;
175
	u_int8_t byte2;
176
	u_int8_t readspeed[2];
177
	u_int8_t writespeed[2];
178
	u_int8_t unused[5];
179
	u_int8_t control;
180
};
181
172
struct scsi_report_key 
182
struct scsi_report_key 
173
{
183
{
174
	u_int8_t opcode;
184
	u_int8_t opcode;
Lines 251-256 Link Here
251
#define PLAY_12			0xa5	/* cdrom pause in 'play audio' mode */
261
#define PLAY_12			0xa5	/* cdrom pause in 'play audio' mode */
252
#define PLAY_TRACK_REL_BIG	0xa9	/* cdrom play track/index mode */
262
#define PLAY_TRACK_REL_BIG	0xa9	/* cdrom play track/index mode */
253
#define READ_DVD_STRUCTURE	0xad	/* read dvd structure */
263
#define READ_DVD_STRUCTURE	0xad	/* read dvd structure */
264
#define SET_CD_SPEED		0xbb	/* set c/dvd speed */
254
265
255
struct scsi_report_key_data_header
266
struct scsi_report_key_data_header
256
{
267
{

Return to bug 36845