Linux 4.18.10
[linux/fpc-iii.git] / drivers / ide / ide-cd.h
blob04f0f310a85661fa95af199a429bf9758409b713
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Copyright (C) 1996-98 Erik Andersen
4 * Copyright (C) 1998-2000 Jens Axboe
5 */
6 #ifndef _IDE_CD_H
7 #define _IDE_CD_H
9 #include <linux/cdrom.h>
10 #include <asm/byteorder.h>
12 #define IDECD_DEBUG_LOG 0
14 #if IDECD_DEBUG_LOG
15 #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args)
16 #else
17 #define ide_debug_log(lvl, fmt, args...) do {} while (0)
18 #endif
20 #define ATAPI_WAIT_WRITE_BUSY (10 * HZ)
22 /************************************************************************/
24 #define SECTORS_PER_FRAME (CD_FRAMESIZE >> SECTOR_SHIFT)
25 #define SECTOR_BUFFER_SIZE (CD_FRAMESIZE * 32)
27 /* Capabilities Page size including 8 bytes of Mode Page Header */
28 #define ATAPI_CAPABILITIES_PAGE_SIZE (8 + 20)
29 #define ATAPI_CAPABILITIES_PAGE_PAD_SIZE 4
31 /* Structure of a MSF cdrom address. */
32 struct atapi_msf {
33 u8 reserved;
34 u8 minute;
35 u8 second;
36 u8 frame;
39 /* Space to hold the disk TOC. */
40 #define MAX_TRACKS 99
41 struct atapi_toc_header {
42 unsigned short toc_length;
43 u8 first_track;
44 u8 last_track;
47 struct atapi_toc_entry {
48 u8 reserved1;
49 #if defined(__BIG_ENDIAN_BITFIELD)
50 u8 adr : 4;
51 u8 control : 4;
52 #elif defined(__LITTLE_ENDIAN_BITFIELD)
53 u8 control : 4;
54 u8 adr : 4;
55 #else
56 #error "Please fix <asm/byteorder.h>"
57 #endif
58 u8 track;
59 u8 reserved2;
60 union {
61 unsigned lba;
62 struct atapi_msf msf;
63 } addr;
66 struct atapi_toc {
67 int last_session_lba;
68 int xa_flag;
69 unsigned long capacity;
70 struct atapi_toc_header hdr;
71 struct atapi_toc_entry ent[MAX_TRACKS+1];
72 /* One extra for the leadout. */
75 /* Extra per-device info for cdrom drives. */
76 struct cdrom_info {
77 ide_drive_t *drive;
78 struct ide_driver *driver;
79 struct gendisk *disk;
80 struct device dev;
82 /* Buffer for table of contents. NULL if we haven't allocated
83 a TOC buffer for this device yet. */
85 struct atapi_toc *toc;
87 u8 max_speed; /* Max speed of the drive. */
88 u8 current_speed; /* Current speed of the drive. */
90 /* Per-device info needed by cdrom.c generic driver. */
91 struct cdrom_device_info devinfo;
93 unsigned long write_timeout;
96 /* ide-cd_verbose.c */
97 void ide_cd_log_error(const char *, struct request *, struct request_sense *);
99 /* ide-cd.c functions used by ide-cd_ioctl.c */
100 int ide_cd_queue_pc(ide_drive_t *, const unsigned char *, int, void *,
101 unsigned *, struct request_sense *, int, req_flags_t);
102 int ide_cd_read_toc(ide_drive_t *, struct request_sense *);
103 int ide_cdrom_get_capabilities(ide_drive_t *, u8 *);
104 void ide_cdrom_update_speed(ide_drive_t *, u8 *);
105 int cdrom_check_status(ide_drive_t *, struct request_sense *);
107 /* ide-cd_ioctl.c */
108 int ide_cdrom_open_real(struct cdrom_device_info *, int);
109 void ide_cdrom_release_real(struct cdrom_device_info *);
110 int ide_cdrom_drive_status(struct cdrom_device_info *, int);
111 unsigned int ide_cdrom_check_events_real(struct cdrom_device_info *,
112 unsigned int clearing, int slot_nr);
113 int ide_cdrom_tray_move(struct cdrom_device_info *, int);
114 int ide_cdrom_lock_door(struct cdrom_device_info *, int);
115 int ide_cdrom_select_speed(struct cdrom_device_info *, int);
116 int ide_cdrom_get_last_session(struct cdrom_device_info *,
117 struct cdrom_multisession *);
118 int ide_cdrom_get_mcn(struct cdrom_device_info *, struct cdrom_mcn *);
119 int ide_cdrom_reset(struct cdrom_device_info *cdi);
120 int ide_cdrom_audio_ioctl(struct cdrom_device_info *, unsigned int, void *);
121 int ide_cdrom_packet(struct cdrom_device_info *, struct packet_command *);
123 #endif /* _IDE_CD_H */