diff options
author | sos <sos@FreeBSD.org> | 2001-01-10 19:19:47 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2001-01-10 19:19:47 +0000 |
commit | 71db84399169a86b71e939d6bbbdc1f327366ba4 (patch) | |
tree | 87d1a793da250d780f72f9dfdac33c3a557822e6 /sys/dev | |
parent | 4674791c7c083e3afea6e9cb31bbe572cf3d7dbc (diff) | |
download | FreeBSD-src-71db84399169a86b71e939d6bbbdc1f327366ba4.zip FreeBSD-src-71db84399169a86b71e939d6bbbdc1f327366ba4.tar.gz |
Add session argument to *close_disk, allowing to set session type on fixate.
Add support for different blank/erase types.
Update headers.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ata/ata-all.c | 2 | ||||
-rw-r--r-- | sys/dev/ata/ata-all.h | 2 | ||||
-rw-r--r-- | sys/dev/ata/ata-disk.c | 2 | ||||
-rw-r--r-- | sys/dev/ata/ata-disk.h | 2 | ||||
-rw-r--r-- | sys/dev/ata/ata-dma.c | 2 | ||||
-rw-r--r-- | sys/dev/ata/ata-raid.c | 2 | ||||
-rw-r--r-- | sys/dev/ata/ata-raid.h | 2 | ||||
-rw-r--r-- | sys/dev/ata/atapi-all.c | 2 | ||||
-rw-r--r-- | sys/dev/ata/atapi-all.h | 2 | ||||
-rw-r--r-- | sys/dev/ata/atapi-cd.c | 58 | ||||
-rw-r--r-- | sys/dev/ata/atapi-cd.h | 31 | ||||
-rw-r--r-- | sys/dev/ata/atapi-fd.c | 2 | ||||
-rw-r--r-- | sys/dev/ata/atapi-fd.h | 2 | ||||
-rw-r--r-- | sys/dev/ata/atapi-tape.c | 2 | ||||
-rw-r--r-- | sys/dev/ata/atapi-tape.h | 2 |
15 files changed, 54 insertions, 61 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index 024a158..b720441 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -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 diff --git a/sys/dev/ata/ata-all.h b/sys/dev/ata/ata-all.h index 4d2e6c1..afe1d54 100644 --- a/sys/dev/ata/ata-all.h +++ b/sys/dev/ata/ata-all.h @@ -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 diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index 5cc8b32..22a11a2 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -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 diff --git a/sys/dev/ata/ata-disk.h b/sys/dev/ata/ata-disk.h index b2a8de7..8a6d4f2 100644 --- a/sys/dev/ata/ata-disk.h +++ b/sys/dev/ata/ata-disk.h @@ -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 diff --git a/sys/dev/ata/ata-dma.c b/sys/dev/ata/ata-dma.c index cde0c6e..373f128 100644 --- a/sys/dev/ata/ata-dma.c +++ b/sys/dev/ata/ata-dma.c @@ -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 diff --git a/sys/dev/ata/ata-raid.c b/sys/dev/ata/ata-raid.c index 85123aa..53f545c 100644 --- a/sys/dev/ata/ata-raid.c +++ b/sys/dev/ata/ata-raid.c @@ -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 diff --git a/sys/dev/ata/ata-raid.h b/sys/dev/ata/ata-raid.h index 721ec21..b464f19 100644 --- a/sys/dev/ata/ata-raid.h +++ b/sys/dev/ata/ata-raid.h @@ -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 diff --git a/sys/dev/ata/atapi-all.c b/sys/dev/ata/atapi-all.c index afc19f6..21aca15 100644 --- a/sys/dev/ata/atapi-all.c +++ b/sys/dev/ata/atapi-all.c @@ -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 diff --git a/sys/dev/ata/atapi-all.h b/sys/dev/ata/atapi-all.h index 15bc6ff..eebc319 100644 --- a/sys/dev/ata/atapi-all.h +++ b/sys/dev/ata/atapi-all.h @@ -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 diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c index 2b96ce2..5b04962 100644 --- a/sys/dev/ata/atapi-cd.c +++ b/sys/dev/ata/atapi-cd.c @@ -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; diff --git a/sys/dev/ata/atapi-cd.h b/sys/dev/ata/atapi-cd.h index 23f5ba4..3644806 100644 --- a/sys/dev/ata/atapi-cd.h +++ b/sys/dev/ata/atapi-cd.h @@ -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; diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c index 3f16083..d702b97 100644 --- a/sys/dev/ata/atapi-fd.c +++ b/sys/dev/ata/atapi-fd.c @@ -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 diff --git a/sys/dev/ata/atapi-fd.h b/sys/dev/ata/atapi-fd.h index 203dcea..8c633d4 100644 --- a/sys/dev/ata/atapi-fd.h +++ b/sys/dev/ata/atapi-fd.h @@ -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 diff --git a/sys/dev/ata/atapi-tape.c b/sys/dev/ata/atapi-tape.c index 5c7b59a..05d80ca 100644 --- a/sys/dev/ata/atapi-tape.c +++ b/sys/dev/ata/atapi-tape.c @@ -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 diff --git a/sys/dev/ata/atapi-tape.h b/sys/dev/ata/atapi-tape.h index d978c7f..24d90e6 100644 --- a/sys/dev/ata/atapi-tape.h +++ b/sys/dev/ata/atapi-tape.h @@ -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 |