The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/ata/atapi-cd.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 1998 - 2004 Søren Schmidt <sos@FreeBSD.org>
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer,
   10  *    without modification, immediately at the beginning of the file.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  * 3. The name of the author may not be used to endorse or promote products
   15  *    derived from this software without specific prior written permission.
   16  *
   17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   27  *
   28  * $FreeBSD$
   29  */
   30 
   31 /* CDROM Table Of Contents */
   32 #define MAXTRK 99
   33 struct toc {
   34     struct ioc_toc_header       hdr;
   35     struct cd_toc_entry         tab[MAXTRK + 1];
   36 };
   37 
   38 /* DVD CSS authentication */
   39 struct dvd_miscauth {
   40     u_int16_t   length;
   41     u_int16_t   reserved;
   42     u_int8_t    data[2048];
   43 };
   44 
   45 /* CDROM Audio Control Parameters Page */
   46 struct audiopage {
   47     /* mode page data header */
   48     u_int16_t   data_length;
   49     u_int8_t    medium_type;
   50     u_int8_t    dev_spec;
   51     u_int8_t    unused[2];
   52     u_int16_t   blk_desc_len;
   53 
   54     /* audio control page */
   55     u_int8_t    page_code;
   56 #define ATAPI_CDROM_AUDIO_PAGE      0x0e
   57 #define ATAPI_CDROM_AUDIO_PAGE_MASK 0x4e
   58 
   59     u_int8_t    param_len;
   60     u_int8_t    flags;
   61 #define CD_PA_SOTC      0x02
   62 #define CD_PA_IMMED     0x04
   63 
   64     u_int8_t    reserved3;
   65     u_int8_t    reserved4;
   66     u_int8_t    reserved5;
   67     u_int16_t   lb_per_sec;
   68     struct port_control {
   69         u_int8_t        channels:4;
   70 #define CHANNEL_0       1
   71 #define CHANNEL_1       2
   72 #define CHANNEL_2       4
   73 #define CHANNEL_3       8
   74 
   75         u_int8_t        volume;
   76     } port[4];
   77 };
   78 
   79 
   80 /* CDROM Capabilities and Mechanical Status Page */
   81 struct cappage {
   82     /* mode page data header */
   83     u_int16_t   data_length;
   84     u_int8_t    medium_type;
   85 #define MST_TYPE_MASK_LOW       0x0f
   86 #define MST_FMT_NONE            0x00
   87 #define MST_DATA_120            0x01
   88 #define MST_AUDIO_120           0x02
   89 #define MST_COMB_120            0x03
   90 #define MST_PHOTO_120           0x04
   91 #define MST_DATA_80             0x05
   92 #define MST_AUDIO_80            0x06
   93 #define MST_COMB_80             0x07
   94 #define MST_PHOTO_80            0x08
   95 
   96 #define MST_TYPE_MASK_HIGH      0x70
   97 #define MST_CDROM               0x00
   98 #define MST_CDR                 0x10
   99 #define MST_CDRW                0x20
  100 
  101 #define MST_NO_DISC             0x70
  102 #define MST_DOOR_OPEN           0x71
  103 #define MST_FMT_ERROR           0x72
  104 
  105     u_int8_t    dev_spec;
  106     u_int16_t   unused;
  107     u_int16_t   blk_desc_len;
  108 
  109     /* capabilities page */
  110     u_int8_t    page_code;
  111 #define ATAPI_CDROM_CAP_PAGE    0x2a
  112 
  113     u_int8_t    param_len;
  114 
  115     u_int16_t   media;
  116 #define MST_READ_CDR            0x0001
  117 #define MST_READ_CDRW           0x0002
  118 #define MST_READ_PACKET         0x0004
  119 #define MST_READ_DVDROM         0x0008
  120 #define MST_READ_DVDR           0x0010
  121 #define MST_READ_DVDRAM         0x0020
  122 #define MST_WRITE_CDR           0x0100
  123 #define MST_WRITE_CDRW          0x0200
  124 #define MST_WRITE_TEST          0x0400
  125 #define MST_WRITE_DVDR          0x1000
  126 #define MST_WRITE_DVDRAM        0x2000
  127 
  128     u_int16_t   capabilities;
  129 #define MST_AUDIO_PLAY          0x0001
  130 #define MST_COMPOSITE           0x0002
  131 #define MST_AUDIO_P1            0x0004
  132 #define MST_AUDIO_P2            0x0008
  133 #define MST_MODE2_f1            0x0010
  134 #define MST_MODE2_f2            0x0020
  135 #define MST_MULTISESSION        0x0040
  136 #define MST_BURNPROOF           0x0080
  137 #define MST_READ_CDDA           0x0100
  138 #define MST_CDDA_STREAM         0x0200
  139 #define MST_COMBINED_RW         0x0400
  140 #define MST_CORRECTED_RW        0x0800
  141 #define MST_SUPPORT_C2          0x1000
  142 #define MST_ISRC                0x2000
  143 #define MST_UPC                 0x4000
  144 
  145     u_int8_t    mechanism;
  146 #define MST_LOCKABLE            0x01
  147 #define MST_LOCKED              0x02
  148 #define MST_PREVENT             0x04
  149 #define MST_EJECT               0x08
  150 #define MST_MECH_MASK           0xe0
  151 #define MST_MECH_CADDY          0x00
  152 #define MST_MECH_TRAY           0x20
  153 #define MST_MECH_POPUP          0x40
  154 #define MST_MECH_CHANGER        0x80
  155 #define MST_MECH_CARTRIDGE      0xa0
  156 
  157     uint8_t     audio;
  158 #define MST_SEP_VOL             0x01
  159 #define MST_SEP_MUTE            0x02
  160 
  161     u_int16_t   max_read_speed;         /* max raw data rate in bytes/1000 */
  162     u_int16_t   max_vol_levels;         /* number of discrete volume levels */
  163     u_int16_t   buf_size;               /* internal buffer size in bytes/1024 */
  164     u_int16_t   cur_read_speed;         /* current data rate in bytes/1000  */
  165 
  166     u_int8_t    reserved3;
  167     u_int8_t    misc;
  168 
  169     u_int16_t   max_write_speed;        /* max raw data rate in bytes/1000 */
  170     u_int16_t   cur_write_speed;        /* current data rate in bytes/1000  */
  171     u_int16_t   copy_protect_rev;
  172     u_int16_t   reserved4;
  173 };
  174 
  175 #define CH_READY                0
  176 #define CH_LOADING              1
  177 #define CH_UNLOADING            2
  178 #define CH_INITIALIZING         3
  179 
  180 #define CD_IDLE                 0
  181 #define CD_AUDIO_ACTIVE         1
  182 #define CD_AUDIO_SCAN           2
  183 #define CD_HOST_ACTIVE          3
  184 #define CD_NO_STATE             7
  185 
  186 /* CDROM Changer mechanism status structure */
  187 struct changer {
  188     u_int8_t    current_slot    :5;     /* active changer slot */
  189     u_int8_t    mech_state      :2;     /* current changer state */
  190 
  191     u_int8_t    fault           :1;     /* fault in last operation */
  192     u_int8_t    reserved0       :5;
  193     u_int8_t    cd_state        :3;     /* current mechanism state */
  194 
  195     u_int8_t    current_lba[3];         /* current LBA */
  196     u_int8_t    slots;                  /* number of available slots */
  197     u_int16_t   table_length;           /* slot table length */
  198     struct {
  199         u_int8_t        changed :1;     /* media has changed in this slot */
  200         u_int8_t        unused  :6;
  201         u_int8_t        present :1;     /* slot has a CD present */
  202         u_int8_t        reserved0;
  203         u_int8_t        reserved1;
  204         u_int8_t        reserved2;
  205     } slot[32];
  206 };
  207 
  208 /* CDROM Write Parameters Mode Page (Burners ONLY) */
  209 struct write_param {
  210     /* mode page data header */
  211     u_int16_t   data_length;
  212     u_int8_t    medium_type;
  213     u_int8_t    dev_spec;
  214     u_int8_t    unused[2];
  215     u_int16_t   blk_desc_len;
  216 
  217     /* write parameters page */
  218     u_int8_t    page_code;
  219 #define ATAPI_CDROM_WRITE_PARAMETERS_PAGE      0x05
  220 
  221     u_int8_t    page_length;            /* 0x32 */
  222     u_int8_t    write_type      :4;     /* write stream type */
  223 #define CDR_WTYPE_PACKET        0x00
  224 #define CDR_WTYPE_TRACK         0x01
  225 #define CDR_WTYPE_SESSION       0x02
  226 #define CDR_WTYPE_RAW           0x03
  227 
  228     u_int8_t    test_write      :1;     /* test write enable */
  229     u_int8_t    link_size_valid :1;
  230     u_int8_t    burnproof       :1;     /* BurnProof enable */
  231     u_int8_t    reserved2_7     :1;
  232     u_int8_t    track_mode      :4;     /* track mode */
  233 #define CDR_TMODE_AUDIO         0x00
  234 #define CDR_TMODE_AUDIO_PREEMP  0x01
  235 #define CDR_TMODE_ALLOW_COPY    0x02
  236 #define CDR_TMODE_DATA          0x04
  237 #define CDR_TMODE_QUAD_AUDIO    0x08
  238 
  239     u_int8_t    copy            :1;     /* generation stamp */
  240     u_int8_t    fp              :1;     /* fixed packet type */
  241     u_int8_t    session_type    :2;     /* session type */
  242 #define CDR_SESS_NONE           0x00
  243 #define CDR_SESS_FINAL          0x01
  244 #define CDR_SESS_RESERVED       0x02
  245 #define CDR_SESS_MULTI          0x03
  246 
  247     u_int8_t    datablock_type  :4;     /* data type code (see cdrio.h) */
  248     u_int8_t    reserved4_4567  :4;
  249     u_int8_t    link_size;
  250     u_int8_t    reserved6;
  251     u_int8_t    host_app_code   :6;     /* host application code */
  252     u_int8_t    reserved7_67    :2;
  253     u_int8_t    session_format;         /* session format */
  254 #define CDR_SESS_CDROM          0x00
  255 #define CDR_SESS_CDI            0x10
  256 #define CDR_SESS_CDROM_XA       0x20
  257 
  258     u_int8_t    reserved9;
  259     u_int32_t   packet_size;            /* packet size in bytes */
  260     u_int16_t   audio_pause_length;     /* audio pause length in secs */
  261     u_int8_t    media_catalog_number[16];
  262     u_int8_t    isr_code[16];
  263     u_int8_t    sub_hdr_byte0;
  264     u_int8_t    sub_hdr_byte1;
  265     u_int8_t    sub_hdr_byte2;
  266     u_int8_t    sub_hdr_byte3;
  267     u_int8_t    vendor_specific_byte0;
  268     u_int8_t    vendor_specific_byte1;
  269     u_int8_t    vendor_specific_byte2;
  270     u_int8_t    vendor_specific_byte3;
  271 } __packed;
  272 
  273 /* CDROM Read Track Information structure */
  274 struct acd_track_info {
  275     u_int16_t   data_length;
  276     u_int8_t    track_number;           /* current track number */
  277     u_int8_t    session_number;         /* current session number */
  278     u_int8_t    reserved4;
  279     u_int8_t    track_mode      :4;     /* mode of this track */
  280     u_int8_t    copy            :1;     /* generation stamp */
  281     u_int8_t    damage          :1;     /* damaged track */
  282     u_int8_t    reserved5_67    :2;
  283     u_int8_t    data_mode       :4;     /* data mode of this disc */
  284     u_int8_t    fp              :1;     /* fixed packet */
  285     u_int8_t    packet          :1;     /* packet track */
  286     u_int8_t    blank           :1;     /* blank (empty) track */
  287     u_int8_t    rt              :1;     /* reserved track */
  288     u_int8_t    nwa_valid       :1;     /* next_writeable_addr field valid */
  289     u_int8_t    reserved7_17    :7;
  290     u_int       track_start_addr;       /* start of this track */
  291     u_int       next_writeable_addr;    /* next writeable addr on this disc */
  292     u_int       free_blocks;            /* free block on this disc */
  293     u_int       fixed_packet_size;      /* size of packets on this track */
  294     u_int       track_length;           /* length of this track */
  295 };
  296 
  297 /* Structure describing an ATAPI CDROM device */
  298 struct acd_softc {
  299     struct ata_device           *device;        /* device softc */
  300     int                         lun;            /* logical device unit */
  301     int                         flags;          /* device state flags */
  302 #define         F_LOCKED                0x0001  /* this unit is locked */
  303 
  304     struct mtx                  queue_mtx;      /* bio queue lock */
  305     struct bio_queue_head       queue;          /* queue of i/o requests */
  306     struct toc                  toc;            /* table of disc contents */
  307     struct audiopage            au;             /* audio page info */
  308     struct audiopage            aumask;         /* audio page mask */
  309     struct cappage              cap;            /* capabilities page info */
  310     struct cd_sub_channel_info  subchan;        /* subchannel info */
  311     struct changer              *changer_info;  /* changer info */
  312     struct acd_softc            **driver;       /* softc's of changer slots */
  313     int                         slot;           /* this instance slot number */
  314     time_t                      timestamp;      /* this instance timestamp */
  315     u_int32_t                   disk_size;      /* size of current media */
  316     u_int32_t                   block_size;     /* blocksize currently used */
  317     u_int32_t                   iomax;          /* Max I/O request (bytes) */
  318     struct g_geom               *gp;            /* geom instance */
  319     struct g_provider           *pp[MAXTRK+1];  /* providers */
  320 };

Cache object: 95ef59d85276c0b880ea9c731d6ea061


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.