More in line with rest of MMC stuff.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: freebsd.c,v 1.32 2004/07/31 09:14:59 rocky Exp $
|
$Id: freebsd.c,v 1.33 2004/07/31 09:26:31 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: freebsd.c,v 1.32 2004/07/31 09:14:59 rocky Exp $";
|
static const char _rcsid[] = "$Id: freebsd.c,v 1.33 2004/07/31 09:26:31 rocky Exp $";
|
||||||
|
|
||||||
#include "freebsd.h"
|
#include "freebsd.h"
|
||||||
|
|
||||||
@@ -322,15 +322,15 @@ get_drive_cap_freebsd (const void *p_user_data,
|
|||||||
Return 0 if no error.
|
Return 0 if no error.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
scsi_mmc_run_cmd_freebsd( const void *p_user_data, int i_timeout,
|
run_scsi_cmd_frebsd( const void *p_user_data, unsigned int i_timeout_ms,
|
||||||
unsigned int i_cdb, const scsi_mmc_cdb_t *p_cdb,
|
unsigned int i_cdb, const scsi_mmc_cdb_t *p_cdb,
|
||||||
scsi_mmc_direction_t e_direction,
|
scsi_mmc_direction_t e_direction,
|
||||||
unsigned int i_buf, /*in/out*/ void *p_buf )
|
unsigned int i_buf, /*in/out*/ void *p_buf )
|
||||||
{
|
{
|
||||||
const _img_private_t *p_env = p_user_data;
|
const _img_private_t *p_env = p_user_data;
|
||||||
|
|
||||||
if (p_env->access_mode == _AM_CAM)
|
if (p_env->access_mode == _AM_CAM)
|
||||||
return scsi_mmc_run_cmd_freebsd_cam( p_user_data, i_timeout, i_cdb, p_cdb,
|
return run_scsi_cmd_frebsd_cam( p_user_data, i_timeout, i_cdb, p_cdb,
|
||||||
e_direction, i_buf, p_buf );
|
e_direction, i_buf, p_buf );
|
||||||
else
|
else
|
||||||
return 2;
|
return 2;
|
||||||
@@ -590,7 +590,7 @@ cdio_open_am_freebsd (const char *psz_orig_source_name,
|
|||||||
.read_audio_sectors = _read_audio_sectors_freebsd,
|
.read_audio_sectors = _read_audio_sectors_freebsd,
|
||||||
.read_mode2_sector = _read_mode2_sector_freebsd,
|
.read_mode2_sector = _read_mode2_sector_freebsd,
|
||||||
.read_mode2_sectors = _read_mode2_sectors_freebsd,
|
.read_mode2_sectors = _read_mode2_sectors_freebsd,
|
||||||
.run_scsi_mmc_cmd = scsi_mmc_run_cmd_freebsd,
|
.run_scsi_mmc_cmd = run_scsi_cmd_frebsd,
|
||||||
.set_arg = _set_arg_freebsd,
|
.set_arg = _set_arg_freebsd,
|
||||||
.stat_size = _stat_size_freebsd
|
.stat_size = _stat_size_freebsd
|
||||||
};
|
};
|
||||||
@@ -618,7 +618,7 @@ cdio_open_am_freebsd (const char *psz_orig_source_name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = cdio_new (_data, &_funcs);
|
ret = cdio_new ((void *)_data, &_funcs);
|
||||||
if (ret == NULL) return NULL;
|
if (ret == NULL) return NULL;
|
||||||
|
|
||||||
if (cdio_generic_init(_data))
|
if (cdio_generic_init(_data))
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: freebsd.h,v 1.20 2004/07/31 09:15:25 rocky Exp $
|
$Id: freebsd.h,v 1.21 2004/07/31 09:26:31 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -212,12 +212,13 @@ bool read_toc_freebsd_ioctl (_img_private_t *env);
|
|||||||
|
|
||||||
Return 0 if no error.
|
Return 0 if no error.
|
||||||
*/
|
*/
|
||||||
int scsi_mmc_run_cmd_freebsd_cam( const void *p_user_data, int i_timeout,
|
int run_scsi_cmd_freebsd_cam( const void *p_user_data,
|
||||||
unsigned int i_cdb,
|
unsigned int i_timeout_ms,
|
||||||
const scsi_mmc_cdb_t *p_cdb,
|
unsigned int i_cdb,
|
||||||
scsi_mmc_direction_t e_direction,
|
const scsi_mmc_cdb_t *p_cdb,
|
||||||
unsigned int i_buf,
|
scsi_mmc_direction_t e_direction,
|
||||||
/*in/out*/ void *p_buf );
|
unsigned int i_buf,
|
||||||
|
/*in/out*/ void *p_buf );
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Return the size of the CD in logical block address (LBA) units.
|
Return the size of the CD in logical block address (LBA) units.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: freebsd_cam.c,v 1.26 2004/07/28 11:45:21 rocky Exp $
|
$Id: freebsd_cam.c,v 1.27 2004/07/31 09:26:31 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: freebsd_cam.c,v 1.26 2004/07/28 11:45:21 rocky Exp $";
|
static const char _rcsid[] = "$Id: freebsd_cam.c,v 1.27 2004/07/31 09:26:31 rocky Exp $";
|
||||||
|
|
||||||
#ifdef HAVE_FREEBSD_CDROM
|
#ifdef HAVE_FREEBSD_CDROM
|
||||||
|
|
||||||
@@ -53,10 +53,10 @@ static const char _rcsid[] = "$Id: freebsd_cam.c,v 1.26 2004/07/28 11:45:21 rock
|
|||||||
Return 0 if no error.
|
Return 0 if no error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
scsi_mmc_run_cmd_freebsd_cam( const void *p_user_data, int i_timeout,
|
run_scsi_cmd_freebsd_cam( const void *p_user_data, int i_timeout,
|
||||||
unsigned int i_cdb, const scsi_mmc_cdb_t *p_cdb,
|
unsigned int i_cdb, const scsi_mmc_cdb_t *p_cdb,
|
||||||
scsi_mmc_direction_t e_direction,
|
scsi_mmc_direction_t e_direction,
|
||||||
unsigned int i_buf, /*in/out*/ void *p_buf )
|
unsigned int i_buf, /*in/out*/ void *p_buf )
|
||||||
{
|
{
|
||||||
const _img_private_t *p_env = p_user_data;
|
const _img_private_t *p_env = p_user_data;
|
||||||
int i_status;
|
int i_status;
|
||||||
@@ -180,10 +180,10 @@ get_drive_cap_freebsd_cam (const _img_private_t *p_env,
|
|||||||
cdb.field[7] = 0x01;
|
cdb.field[7] = 0x01;
|
||||||
cdb.field[8] = 0x00;
|
cdb.field[8] = 0x00;
|
||||||
|
|
||||||
i_status = scsi_mmc_run_cmd_freebsd_cam(p_env, DEFAULT_TIMEOUT_MSECS,
|
i_status = run_scsi_cmd_freebsd_cam(p_env, DEFAULT_TIMEOUT_MSECS,
|
||||||
scsi_mmc_get_cmd_len(cdb.field[0]),
|
scsi_mmc_get_cmd_len(cdb.field[0]),
|
||||||
&cdb, SCSI_MMC_DATA_READ,
|
&cdb, SCSI_MMC_DATA_READ,
|
||||||
sizeof(buf), buf);
|
sizeof(buf), buf);
|
||||||
if (0 == i_status) {
|
if (0 == i_status) {
|
||||||
uint8_t *p;
|
uint8_t *p;
|
||||||
int lenData = ((unsigned int)buf[0] << 8) + buf[1];
|
int lenData = ((unsigned int)buf[0] << 8) + buf[1];
|
||||||
@@ -257,10 +257,10 @@ _set_bsize (_img_private_t *p_env, unsigned int bsize)
|
|||||||
cdb.field[1] = 1 << 4;
|
cdb.field[1] = 1 << 4;
|
||||||
cdb.field[4] = 12;
|
cdb.field[4] = 12;
|
||||||
|
|
||||||
return scsi_mmc_run_cmd_freebsd_cam (p_env, DEFAULT_TIMEOUT_MSECS,
|
return run_scsi_cmd_freebsd_cam (p_env, DEFAULT_TIMEOUT_MSECS,
|
||||||
scsi_mmc_get_cmd_len(cdb.field[0]),
|
scsi_mmc_get_cmd_len(cdb.field[0]),
|
||||||
&cdb, SCSI_MMC_DATA_WRITE,
|
&cdb, SCSI_MMC_DATA_WRITE,
|
||||||
sizeof(mh), &mh);
|
sizeof(mh), &mh);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -302,7 +302,7 @@ read_mode2_sectors_freebsd_cam (_img_private_t *p_env, void *p_buf,
|
|||||||
if ((retval = _set_bsize (p_env, M2RAW_SECTOR_SIZE)))
|
if ((retval = _set_bsize (p_env, M2RAW_SECTOR_SIZE)))
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if ((retval = scsi_mmc_run_cmd_freebsd_cam (p_env, 0,
|
if ((retval = run_scsi_cmd_freebsd_cam (p_env, 0,
|
||||||
scsi_mmc_get_cmd_len(cdb.field[0]),
|
scsi_mmc_get_cmd_len(cdb.field[0]),
|
||||||
&cdb,
|
&cdb,
|
||||||
SCSI_MMC_DATA_READ,
|
SCSI_MMC_DATA_READ,
|
||||||
@@ -320,7 +320,7 @@ read_mode2_sectors_freebsd_cam (_img_private_t *p_env, void *p_buf,
|
|||||||
CDIO_MMC_SET_READ_LENGTH24(cdb.field, nblocks);
|
CDIO_MMC_SET_READ_LENGTH24(cdb.field, nblocks);
|
||||||
cdb.field[1] = 0; /* sector size mode2 */
|
cdb.field[1] = 0; /* sector size mode2 */
|
||||||
cdb.field[9] = 0x58; /* 2336 mode2 */
|
cdb.field[9] = 0x58; /* 2336 mode2 */
|
||||||
return scsi_mmc_run_cmd_freebsd_cam (p_env, 0,
|
return run_scsi_cmd_freebsd_cam (p_env, 0,
|
||||||
scsi_mmc_get_cmd_len(cdb.field[0]),
|
scsi_mmc_get_cmd_len(cdb.field[0]),
|
||||||
&cdb,
|
&cdb,
|
||||||
SCSI_MMC_DATA_READ,
|
SCSI_MMC_DATA_READ,
|
||||||
@@ -356,7 +356,7 @@ stat_size_freebsd_cam (_img_private_t *p_env)
|
|||||||
p_env->ccb.csio.data_ptr = buf;
|
p_env->ccb.csio.data_ptr = buf;
|
||||||
p_env->ccb.csio.dxfer_len = sizeof (buf);
|
p_env->ccb.csio.dxfer_len = sizeof (buf);
|
||||||
|
|
||||||
i_status = scsi_mmc_run_cmd_freebsd_cam(p_env, DEFAULT_TIMEOUT_MSECS,
|
i_status = run_scsi_cmd_freebsd_cam(p_env, DEFAULT_TIMEOUT_MSECS,
|
||||||
scsi_mmc_get_cmd_len(cdb.field[0]),
|
scsi_mmc_get_cmd_len(cdb.field[0]),
|
||||||
&cdb, SCSI_MMC_DATA_READ,
|
&cdb, SCSI_MMC_DATA_READ,
|
||||||
sizeof(buf), buf);
|
sizeof(buf), buf);
|
||||||
@@ -389,14 +389,14 @@ eject_media_freebsd_cam (_img_private_t *p_env)
|
|||||||
|
|
||||||
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_ALLOW_MEDIUM_REMOVAL);
|
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_ALLOW_MEDIUM_REMOVAL);
|
||||||
|
|
||||||
i_status = scsi_mmc_run_cmd_freebsd_cam (p_env, DEFAULT_TIMEOUT_MSECS,
|
i_status = run_scsi_cmd_freebsd_cam (p_env, DEFAULT_TIMEOUT_MSECS,
|
||||||
scsi_mmc_get_cmd_len(cdb.field[0]),
|
scsi_mmc_get_cmd_len(cdb.field[0]),
|
||||||
&cdb, SCSI_MMC_DATA_WRITE, 0, &buf);
|
&cdb, SCSI_MMC_DATA_WRITE, 0, &buf);
|
||||||
if (0 != i_status)
|
if (0 != i_status)
|
||||||
return i_status;
|
return i_status;
|
||||||
|
|
||||||
cdb.field[4] = 1;
|
cdb.field[4] = 1;
|
||||||
i_status = scsi_mmc_run_cmd_freebsd_cam (p_env, DEFAULT_TIMEOUT_MSECS,
|
i_status = run_scsi_cmd_freebsd_cam (p_env, DEFAULT_TIMEOUT_MSECS,
|
||||||
scsi_mmc_get_cmd_len(cdb.field[0]), &cdb,
|
scsi_mmc_get_cmd_len(cdb.field[0]), &cdb,
|
||||||
SCSI_MMC_DATA_WRITE, 0, &buf);
|
SCSI_MMC_DATA_WRITE, 0, &buf);
|
||||||
if (0 != i_status)
|
if (0 != i_status)
|
||||||
@@ -405,7 +405,7 @@ eject_media_freebsd_cam (_img_private_t *p_env)
|
|||||||
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_START_STOP);
|
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_START_STOP);
|
||||||
cdb.field[4] = 2; /* eject */
|
cdb.field[4] = 2; /* eject */
|
||||||
|
|
||||||
return scsi_mmc_run_cmd_freebsd_cam (p_env, DEFAULT_TIMEOUT_MSECS,
|
return run_scsi_cmd_freebsd_cam (p_env, DEFAULT_TIMEOUT_MSECS,
|
||||||
scsi_mmc_get_cmd_len(cdb.field[0]),
|
scsi_mmc_get_cmd_len(cdb.field[0]),
|
||||||
&cdb,
|
&cdb,
|
||||||
SCSI_MMC_DATA_WRITE, 0, &buf);
|
SCSI_MMC_DATA_WRITE, 0, &buf);
|
||||||
|
|||||||
Reference in New Issue
Block a user