Sun drive capabilities improved. Sun and Windows ASPI use common

MODE_SENSE defines defines now.
This commit is contained in:
rocky
2004-07-08 06:29:45 +00:00
parent 29c858060f
commit 4058457e52
4 changed files with 42 additions and 27 deletions

View File

@@ -1,5 +1,5 @@
/* /*
$Id: scsi_mmc.h,v 1.6 2004/07/08 01:27:59 rocky Exp $ $Id: scsi_mmc.h,v 1.7 2004/07/08 06:29:45 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -54,6 +54,7 @@
#define CDIO_MMC_R_W_ERROR_PAGE 0x01 #define CDIO_MMC_R_W_ERROR_PAGE 0x01
#define CDIO_MMC_WRITE_PARMS_PAGE 0x05 #define CDIO_MMC_WRITE_PARMS_PAGE 0x05
#define CDIO_MMC_AUDIO_CTL_PAGE 0x0e #define CDIO_MMC_AUDIO_CTL_PAGE 0x0e
#define CDIO_MMC_CDR_PARMS_PAGE 0x0d
#define CDIO_MMC_POWER_PAGE 0x1a #define CDIO_MMC_POWER_PAGE 0x1a
#define CDIO_MMC_FAULT_FAIL_PAGE 0x1c #define CDIO_MMC_FAULT_FAIL_PAGE 0x1c
#define CDIO_MMC_TO_PROTECT_PAGE 0x1d #define CDIO_MMC_TO_PROTECT_PAGE 0x1d

View File

@@ -1,5 +1,5 @@
/* /*
$Id: aspi32.c,v 1.13 2004/07/08 01:28:01 rocky Exp $ $Id: aspi32.c,v 1.14 2004/07/08 06:30:01 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h" # include "config.h"
#endif #endif
static const char _rcsid[] = "$Id: aspi32.c,v 1.13 2004/07/08 01:28:01 rocky Exp $"; static const char _rcsid[] = "$Id: aspi32.c,v 1.14 2004/07/08 06:30:01 rocky Exp $";
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/sector.h> #include <cdio/sector.h>
@@ -746,12 +746,12 @@ get_drive_cap_aspi (const _img_private_t *env)
which = p[0] & 0x3F; which = p[0] & 0x3F;
switch( which ) switch( which )
{ {
case CDRAUDIOCTL: case CDIO_MMC_AUDIO_CTL_PAGE:
case READERRREC: case CDIO_MMC_R_W_ERROR_PAGE:
case CDRPARMS: case CDIO_MMC_CDR_PARMS_PAGE:
/* Don't handle theses yet. */ /* Don't handle these yet. */
break; break;
case CDRCAPS: case CDIO_MMC_CAPABILITIES_PAGE:
i_drivetype |= cdio_get_drive_cap_mmc(p); i_drivetype |= cdio_get_drive_cap_mmc(p);
break; break;
default: ; default: ;

View File

@@ -1,6 +1,6 @@
/* Win32 aspi specific */ /* Win32 aspi specific */
/* /*
$Id: aspi32.h,v 1.3 2004/06/28 00:24:03 rocky Exp $ $Id: aspi32.h,v 1.4 2004/07/08 06:30:17 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -145,14 +145,6 @@ struct SRB_ExecSCSICmd
unsigned char SenseArea[SENSE_LEN+2]; unsigned char SenseArea[SENSE_LEN+2];
}; };
/*!
Values and structures used in MODE SENSE 10 command.
*/
#define READERRREC 0x01
#define CDRPARMS 0x0D
#define CDRAUDIOCTL 0x0E
#define CDRCAPS 0x2A
/***************************************************************************** /*****************************************************************************
%%% SRB - HOST ADAPTER INQUIRY - SC_HA_INQUIRY (0) %%% %%% SRB - HOST ADAPTER INQUIRY - SC_HA_INQUIRY (0) %%%
*****************************************************************************/ *****************************************************************************/

View File

@@ -1,5 +1,5 @@
/* /*
$Id: _cdio_sunos.c,v 1.43 2004/07/08 05:19:27 rocky Exp $ $Id: _cdio_sunos.c,v 1.44 2004/07/08 06:29:58 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -38,7 +38,7 @@
#ifdef HAVE_SOLARIS_CDROM #ifdef HAVE_SOLARIS_CDROM
static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.43 2004/07/08 05:19:27 rocky Exp $"; static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.44 2004/07/08 06:29:58 rocky Exp $";
#ifdef HAVE_GLOB_H #ifdef HAVE_GLOB_H
#include <glob.h> #include <glob.h>
@@ -517,26 +517,48 @@ _cdio_get_drive_cap_solaris (const void *user_data)
memset(&my_rq_buf, 0, sizeof(my_rq_buf)); memset(&my_rq_buf, 0, sizeof(my_rq_buf));
/* Initialize my_scsi_cdb as a Mode Select(6) */ /* Initialize my_scsi_cdb as a Mode Select(6) */
CDIO_MMC_SET_COMMAND(my_scsi_cdb, CDIO_MMC_GPCMD_MODE_SENSE); CDIO_MMC_SET_COMMAND(my_scsi_cdb, CDIO_MMC_GPCMD_MODE_SENSE_10);
my_scsi_cdb[1] = 0x0; my_scsi_cdb[1] = 0x0;
my_scsi_cdb[2] = CDIO_MMC_CAPABILITIES_PAGE; my_scsi_cdb[2] = CDIO_MMC_ALL_PAGES;
my_scsi_cdb[3] = 0; /* Not used */ my_scsi_cdb[7] = 0x01;
my_scsi_cdb[4] = 128; my_scsi_cdb[8] = 0x00;
my_scsi_cdb[5] = 0; /* Not used */
my_cmd.uscsi_flags = (USCSI_READ|USCSI_RQENABLE); /* We're going get data */ my_cmd.uscsi_flags = (USCSI_READ|USCSI_RQENABLE); /* We're going get data */
my_cmd.uscsi_timeout = 15; /* Allow 15 seconds for completion */ my_cmd.uscsi_timeout = 15; /* Allow 15 seconds for completion */
my_cmd.uscsi_cdb = my_scsi_cdb; /* We'll be using the array above for the CDB */ my_cmd.uscsi_cdb = my_scsi_cdb; /* We'll be using the array above for the CDB */
my_cmd.uscsi_bufaddr = buf; /* The block and page data is stored here */ my_cmd.uscsi_bufaddr = buf; /* The block and page data is stored here */
my_cmd.uscsi_buflen = sizeof(buf); my_cmd.uscsi_buflen = sizeof(buf);
my_cmd.uscsi_cdblen = 6; /* The CDB is 6 bytes long */ my_cmd.uscsi_cdblen = 12;
my_cmd.uscsi_rqlen = 24; /* The request sense buffer (only valid on a check condition) is 26 bytes long */ my_cmd.uscsi_rqlen = 24; /* The request sense buffer (only valid on a check condition) is 26 bytes long */
my_cmd.uscsi_rqbuf = my_rq_buf; /* Pointer to the request sense buffer */ my_cmd.uscsi_rqbuf = my_rq_buf; /* Pointer to the request sense buffer */
rc = ioctl(env->gen.fd, USCSICMD, &my_cmd); rc = ioctl(env->gen.fd, USCSICMD, &my_cmd);
if(rc == 0) { if(rc == 0) {
unsigned int n=buf[3]+4; uint8_t *p;
i_drivetype |= cdio_get_drive_cap_mmc(&(buf[n])); int lenData = ((unsigned int)buf[0] << 8) + buf[1];
uint8_t *pMax = buf + 256;
i_drivetype = 0;
/* set to first sense mask, and then walk through the masks */
p = buf + 8;
while( (p < &(buf[2+lenData])) && (p < pMax) ) {
uint8_t which;
which = p[0] & 0x3F;
switch( which )
{
case CDIO_MMC_AUDIO_CTL_PAGE:
case CDIO_MMC_R_W_ERROR_PAGE:
case CDIO_MMC_CDR_PARMS_PAGE:
/* Don't handle these yet. */
break;
case CDIO_MMC_CAPABILITIES_PAGE:
i_drivetype |= cdio_get_drive_cap_mmc(p);
break;
default: ;
}
p += (p[1] + 2);
}
} else { } else {
cdio_info("%s: %s\n", cdio_info("%s: %s\n",
"error in ioctl USCSICMD MODE_SELECT", strerror(errno)); "error in ioctl USCSICMD MODE_SELECT", strerror(errno));