mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Add session argument to *close_disk, allowing to set session type on fixate.
Add support for different blank/erase types. Update headers.
This commit is contained in:
parent
de6aa2bfcc
commit
95eaffae1b
15 changed files with 54 additions and 61 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/*-
|
||||
* Copyright (c) 1998,1999,2000 Søren Schmidt
|
||||
* Copyright (c) 1998,1999,2000,2001 Søren Schmidt
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*-
|
||||
* Copyright (c) 1998,1999,2000 Søren Schmidt
|
||||
* Copyright (c) 1998,1999,2000,2001 Søren Schmidt
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*-
|
||||
* Copyright (c) 1998,1999,2000 Søren Schmidt
|
||||
* Copyright (c) 1998,1999,2000,2001 Søren Schmidt
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*-
|
||||
* Copyright (c) 1998,1999,2000 Søren Schmidt
|
||||
* Copyright (c) 1998,1999,2000,2001 Søren Schmidt
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*-
|
||||
* Copyright (c) 1998,1999,2000 Søren Schmidt
|
||||
* Copyright (c) 1998,1999,2000,2001 Søren Schmidt
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*-
|
||||
* Copyright (c) 2000 Søren Schmidt
|
||||
* Copyright (c) 2000,2001 Søren Schmidt
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*-
|
||||
* Copyright (c) 2000 Søren Schmidt
|
||||
* Copyright (c) 2000,2001 Søren Schmidt
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*-
|
||||
* Copyright (c) 1998,1999,2000 Søren Schmidt
|
||||
* Copyright (c) 1998,1999,2000,2001 Søren Schmidt
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*-
|
||||
* Copyright (c) 1998,1999,2000 Søren Schmidt
|
||||
* Copyright (c) 1998,1999,2000,2001 Søren Schmidt
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*-
|
||||
* Copyright (c) 1998,1999,2000 Søren Schmidt
|
||||
* Copyright (c) 1998,1999,2000,2001 Søren Schmidt
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -81,14 +81,14 @@ static int acd_setchan(struct acd_softc *, u_int8_t, u_int8_t, u_int8_t, u_int8_
|
|||
static void acd_select_slot(struct acd_softc *);
|
||||
static int acd_open_track(struct acd_softc *, struct cdr_track *);
|
||||
static int acd_close_track(struct acd_softc *);
|
||||
static int acd_close_disk(struct acd_softc *);
|
||||
static int acd_close_disk(struct acd_softc *, int);
|
||||
static int acd_read_track_info(struct acd_softc *, int32_t, struct acd_track_info*);
|
||||
static int acd_get_progress(struct acd_softc *cdp, int *);
|
||||
static int acd_report_key(struct acd_softc *, struct dvd_authinfo *);
|
||||
static int acd_send_key(struct acd_softc *, struct dvd_authinfo *);
|
||||
static int acd_read_structure(struct acd_softc *, struct dvd_struct *);
|
||||
static int acd_eject(struct acd_softc *, int);
|
||||
static int acd_blank(struct acd_softc *);
|
||||
static int acd_blank(struct acd_softc *, int);
|
||||
static int acd_prevent_allow(struct acd_softc *, int);
|
||||
static int acd_start_stop(struct acd_softc *, int);
|
||||
static int acd_pause_resume(struct acd_softc *, int);
|
||||
|
|
@ -990,7 +990,7 @@ acdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
|
|||
break;
|
||||
|
||||
case CDRIOCBLANK:
|
||||
error = acd_blank(cdp);
|
||||
error = acd_blank(cdp, (*(int *)addr));
|
||||
break;
|
||||
|
||||
case CDRIOCNEXTWRITEABLEADDR:
|
||||
|
|
@ -1020,7 +1020,7 @@ acdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
|
|||
break;
|
||||
|
||||
case CDRIOCCLOSEDISK:
|
||||
error = acd_close_disk(cdp);
|
||||
error = acd_close_disk(cdp, (*(int *)addr));
|
||||
break;
|
||||
|
||||
case CDRIOCWRITESPEED:
|
||||
|
|
@ -1364,13 +1364,26 @@ acd_select_slot(struct acd_softc *cdp)
|
|||
}
|
||||
|
||||
static int
|
||||
acd_close_disk(struct acd_softc *cdp)
|
||||
acd_close_disk(struct acd_softc *cdp, int multisession)
|
||||
{
|
||||
int8_t ccb[16] = { ATAPI_CLOSE_TRACK, 0x01, 0x02, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
int timeout = 5*60*2;
|
||||
int error;
|
||||
struct write_param param;
|
||||
|
||||
if ((error = acd_mode_sense(cdp, ATAPI_CDROM_WRITE_PARAMETERS_PAGE,
|
||||
(caddr_t)¶m, sizeof(param))))
|
||||
return error;
|
||||
|
||||
if (multisession)
|
||||
param.session_type = CDR_SESS_MULTI;
|
||||
else
|
||||
param.session_type = CDR_SESS_NONE;
|
||||
|
||||
if ((error = acd_mode_select(cdp, (caddr_t)¶m, sizeof(param))))
|
||||
return error;
|
||||
|
||||
error = atapi_queue_cmd(cdp->atp, ccb, NULL, 0, 0, 30, NULL, NULL);
|
||||
if (error)
|
||||
return error;
|
||||
|
|
@ -1396,10 +1409,14 @@ acd_open_track(struct acd_softc *cdp, struct cdr_track *track)
|
|||
param.page_length = 0x32;
|
||||
param.test_write = track->test_write ? 1 : 0;
|
||||
param.write_type = CDR_WTYPE_TRACK;
|
||||
param.session_type = CDR_SESS_MULTI;
|
||||
param.fp = 0;
|
||||
param.packet_size = 0;
|
||||
|
||||
if (cdp->cap.burnproof)
|
||||
param.burnproof = 1;
|
||||
|
||||
switch (track->track_type) {
|
||||
switch (track->datablock_type) {
|
||||
|
||||
case CDR_DB_RAW:
|
||||
if (track->preemp)
|
||||
|
|
@ -1407,60 +1424,53 @@ acd_open_track(struct acd_softc *cdp, struct cdr_track *track)
|
|||
else
|
||||
param.track_mode = CDR_TMODE_AUDIO;
|
||||
cdp->block_size = 2352;
|
||||
param.data_block_type = CDR_DB_RAW;
|
||||
param.datablock_type = CDR_DB_RAW;
|
||||
param.session_format = CDR_SESS_CDROM;
|
||||
break;
|
||||
|
||||
case CDR_DB_ROM_MODE1:
|
||||
cdp->block_size = 2048;
|
||||
param.track_mode = CDR_TMODE_DATA;
|
||||
param.data_block_type = CDR_DB_ROM_MODE1;
|
||||
param.datablock_type = CDR_DB_ROM_MODE1;
|
||||
param.session_format = CDR_SESS_CDROM;
|
||||
break;
|
||||
|
||||
case CDR_DB_ROM_MODE2:
|
||||
cdp->block_size = 2336;
|
||||
param.track_mode = CDR_TMODE_DATA;
|
||||
param.data_block_type = CDR_DB_ROM_MODE2;
|
||||
param.datablock_type = CDR_DB_ROM_MODE2;
|
||||
param.session_format = CDR_SESS_CDROM;
|
||||
break;
|
||||
|
||||
case CDR_DB_XA_MODE1:
|
||||
cdp->block_size = 2048;
|
||||
param.track_mode = CDR_TMODE_DATA;
|
||||
param.data_block_type = CDR_DB_XA_MODE1;
|
||||
param.datablock_type = CDR_DB_XA_MODE1;
|
||||
param.session_format = CDR_SESS_CDROM_XA;
|
||||
break;
|
||||
|
||||
case CDR_DB_XA_MODE2_F1:
|
||||
cdp->block_size = 2056;
|
||||
param.track_mode = CDR_TMODE_DATA;
|
||||
param.data_block_type = CDR_DB_XA_MODE2_F1;
|
||||
param.datablock_type = CDR_DB_XA_MODE2_F1;
|
||||
param.session_format = CDR_SESS_CDROM_XA;
|
||||
break;
|
||||
|
||||
case CDR_DB_XA_MODE2_F2:
|
||||
cdp->block_size = 2324;
|
||||
param.track_mode = CDR_TMODE_DATA;
|
||||
param.data_block_type = CDR_DB_XA_MODE2_F2;
|
||||
param.datablock_type = CDR_DB_XA_MODE2_F2;
|
||||
param.session_format = CDR_SESS_CDROM_XA;
|
||||
break;
|
||||
|
||||
case CDR_DB_XA_MODE2_MIX:
|
||||
cdp->block_size = 2332;
|
||||
param.track_mode = CDR_TMODE_DATA;
|
||||
param.data_block_type = CDR_DB_XA_MODE2_MIX;
|
||||
param.datablock_type = CDR_DB_XA_MODE2_MIX;
|
||||
param.session_format = CDR_SESS_CDROM_XA;
|
||||
break;
|
||||
}
|
||||
|
||||
#if 1
|
||||
param.multi_session = CDR_MSES_MULTI;
|
||||
#else
|
||||
param.multi_session = CDR_MSES_NONE;
|
||||
#endif
|
||||
param.fp = 0;
|
||||
param.packet_size = 0;
|
||||
return acd_mode_select(cdp, (caddr_t)¶m, sizeof(param));
|
||||
}
|
||||
|
||||
|
|
@ -1511,7 +1521,7 @@ acd_get_progress(struct acd_softc *cdp, int *finished)
|
|||
|
||||
error = atapi_queue_cmd(cdp->atp, ccb, (caddr_t)&sense, sizeof(sense),
|
||||
ATPR_F_READ, 10, NULL, NULL);
|
||||
*finished = ((sense.sk_specific2|(sense.sk_specific1<<8))*100) / 65535;
|
||||
*finished = ((sense.sk_specific2|(sense.sk_specific1<<8))*100)/65535;
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
@ -1782,9 +1792,9 @@ acd_eject(struct acd_softc *cdp, int close)
|
|||
}
|
||||
|
||||
static int
|
||||
acd_blank(struct acd_softc *cdp)
|
||||
acd_blank(struct acd_softc *cdp, int blanktype)
|
||||
{
|
||||
int8_t ccb[16] = { ATAPI_BLANK, 0x10 | 0x01, 0, 0, 0, 0, 0, 0,
|
||||
int8_t ccb[16] = { ATAPI_BLANK, 0x10 | (blanktype & 0x7), 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
cdp->atp->flags |= ATAPI_F_MEDIA_CHANGED;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*-
|
||||
* Copyright (c) 1998,1999,2000 Søren Schmidt
|
||||
* Copyright (c) 1998,1999,2000,2001 Søren Schmidt
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -233,30 +233,13 @@ struct write_param {
|
|||
|
||||
u_int8_t copy :1; /* generation stamp */
|
||||
u_int8_t fp :1; /* fixed packet type */
|
||||
u_int8_t multi_session :2; /* multi-session type */
|
||||
#define CDR_MSES_NONE 0x00
|
||||
#define CDR_MSES_FINAL 0x01
|
||||
#define CDR_MSES_RESERVED 0x02
|
||||
#define CDR_MSES_MULTI 0x03
|
||||
|
||||
u_int8_t data_block_type :4; /* data block type code */
|
||||
#define CDR_DB_RAW 0x0 /* 2352 bytes of raw data */
|
||||
#define CDR_DB_RAW_PQ 0x1 /* 2368 bytes raw data + P/Q subchan */
|
||||
#define CDR_DB_RAW_PW 0x2 /* 2448 bytes raw data + P-W subchan */
|
||||
#define CDR_DB_RAW_PW_R 0x3 /* 2448 bytes raw data + P-W raw sub */
|
||||
#define CDR_DB_RES_4 0x4 /* reserved */
|
||||
#define CDR_DB_RES_5 0x5 /* reserved */
|
||||
#define CDR_DB_RES_6 0x6 /* reserved */
|
||||
#define CDR_DB_VS_7 0x7 /* vendor specific */
|
||||
#define CDR_DB_ROM_MODE1 0x8 /* 2048 bytes Mode 1 (ISO/IEC 10149) */
|
||||
#define CDR_DB_ROM_MODE2 0x9 /* 2336 bytes Mode 2 (ISO/IEC 10149) */
|
||||
#define CDR_DB_XA_MODE1 0xa /* 2048 bytes Mode 1 (CD-ROM XA 1) */
|
||||
#define CDR_DB_XA_MODE2_F1 0xb /* 2056 bytes Mode 2 (CD-ROM XA 1) */
|
||||
#define CDR_DB_XA_MODE2_F2 0xc /* 2324 bytes Mode 2 (CD-ROM XA 2) */
|
||||
#define CDR_DB_XA_MODE2_MIX 0xd /* 2332 bytes Mode 2 (CD-ROM XA 1/2) */
|
||||
#define CDR_DB_RES_14 0xe /* reserved */
|
||||
#define CDR_DB_VS_15 0xf /* vendor specific */
|
||||
u_int8_t session_type :2; /* session type */
|
||||
#define CDR_SESS_NONE 0x00
|
||||
#define CDR_SESS_FINAL 0x01
|
||||
#define CDR_SESS_RESERVED 0x02
|
||||
#define CDR_SESS_MULTI 0x03
|
||||
|
||||
u_int8_t datablock_type :4; /* data type code (see cdrio.h) */
|
||||
u_int8_t reserved4_4567 :4;
|
||||
u_int8_t reserved5;
|
||||
u_int8_t reserved6;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*-
|
||||
* Copyright (c) 1998,1999,2000 Søren Schmidt
|
||||
* Copyright (c) 1998,1999,2000,2001 Søren Schmidt
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*-
|
||||
* Copyright (c) 1998,1999,2000 Søren Schmidt
|
||||
* Copyright (c) 1998,1999,2000,2001 Søren Schmidt
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*-
|
||||
* Copyright (c) 1998,1999,2000 Søren Schmidt
|
||||
* Copyright (c) 1998,1999,2000,2001 Søren Schmidt
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*-
|
||||
* Copyright (c) 1998,1999,2000 Søren Schmidt
|
||||
* Copyright (c) 1998,1999,2000,2001 Søren Schmidt
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
Loading…
Reference in a new issue