Werner Zimmermann, August 8, 1995
V1.70 Multisession support now is completed, but there is still not
enough testing done. If you can test it, please contact me. For
- details please read /usr/src/linux/Documentation/cdrom/aztcd
+ details please read Documentation/cdrom/aztcd
Werner Zimmermann, August 19, 1995
V1.80 Modification to suit the new kernel boot procedure introduced
with kernel 1.3.33. Will definitely not work with older kernels.
Torben Mathiasen <tmm@image.dk>
*/
-#include <linux/version.h>
#include <linux/blkdev.h>
#include "aztcd.h"
static int azt_port = AZT_BASE_ADDR;
-MODULE_PARM(azt_port, "i");
+module_param(azt_port, int, 0);
static int azt_port_auto[16] = AZT_BASE_AUTO;
static int AztTimeout, AztTries;
static DECLARE_WAIT_QUEUE_HEAD(azt_waitq);
-static struct timer_list delay_timer = TIMER_INITIALIZER(NULL, 0, 0);
+static DEFINE_TIMER(delay_timer, NULL, 0, 0);
static struct azt_DiskInfo DiskInfo;
static struct azt_Toc Toc[MAX_TRACKS];
static unsigned long aztTimeOutCount;
static int aztCmd = 0;
-static spinlock_t aztSpin = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(aztSpin);
/*###########################################################################
Function Prototypes
}
/* Wait for PA_OK = drive answers with AFL_PA_OK after receiving parameters*/
+#if 0
# define PA_OK pa_ok()
static void pa_ok(void)
{
}
} while (aztIndatum != AFL_PA_OK);
}
+#endif
/* Wait for STEN=Low = handshake signal 'AFL_.._OK available or command executed*/
# define STEN_LOW sten_low()
/* Read the table of contents header, i.e. no. of tracks and start of first
* track
*/
-static int aztGetDiskInfo()
+static int aztGetDiskInfo(void)
{
int limit;
unsigned char test;
struct azt_Toc *tocPtr;
struct cdrom_subchnl subchnl;
struct cdrom_volctrl volctrl;
+ void __user *argp = (void __user *)arg;
#ifdef AZT_DEBUG
printk("aztcd: starting aztcd_ioctl - Command:%x Time: %li\n",
#ifdef AZT_DEBUG
printk("aztcd ioctl MULTISESSION\n");
#endif
- if (copy_from_user
- (&ms, (void *) arg,
+ if (copy_from_user(&ms, argp,
sizeof(struct cdrom_multisession)))
return -EFAULT;
if (ms.addr_format == CDROM_MSF) {
else
return -EINVAL;
ms.xa_flag = DiskInfo.xa;
- if (copy_to_user
- ((void *) arg, &ms,
+ if (copy_to_user(argp, &ms,
sizeof(struct cdrom_multisession)))
return -EFAULT;
#ifdef AZT_DEBUG
return 0;
}
case CDROMPLAYTRKIND: /* Play a track. This currently ignores index. */
- if (copy_from_user(&ti, (void *) arg, sizeof ti))
+ if (copy_from_user(&ti, argp, sizeof ti))
return -EFAULT;
if (ti.cdti_trk0 < DiskInfo.first
|| ti.cdti_trk0 > DiskInfo.last
aztAudioStatus = CDROM_AUDIO_NO_STATUS;
}
*/
- if (copy_from_user(&msf, (void *) arg, sizeof msf))
+ if (copy_from_user(&msf, argp, sizeof msf))
return -EFAULT;
/* convert to bcd */
azt_bin2bcd(&msf.cdmsf_min0);
case CDROMREADTOCHDR: /* Read the table of contents header */
tocHdr.cdth_trk0 = DiskInfo.first;
tocHdr.cdth_trk1 = DiskInfo.last;
- if (copy_to_user((void *) arg, &tocHdr, sizeof tocHdr))
+ if (copy_to_user(argp, &tocHdr, sizeof tocHdr))
return -EFAULT;
break;
case CDROMREADTOCENTRY: /* Read an entry in the table of contents */
- if (copy_from_user(&entry, (void *) arg, sizeof entry))
+ if (copy_from_user(&entry, argp, sizeof entry))
return -EFAULT;
if ((!aztTocUpToDate) || aztDiskChanged)
aztUpdateToc();
} else {
return -EINVAL;
}
- if (copy_to_user((void *) arg, &entry, sizeof entry))
+ if (copy_to_user(argp, &entry, sizeof entry))
return -EFAULT;
break;
case CDROMSUBCHNL: /* Get subchannel info */
if (copy_from_user
- (&subchnl, (void *) arg, sizeof(struct cdrom_subchnl)))
+ (&subchnl, argp, sizeof(struct cdrom_subchnl)))
return -EFAULT;
if (aztGetQChannelInfo(&qInfo) < 0) {
#ifdef AZT_DEBUG
subchnl.cdsc_reladdr.msf.frame =
azt_bcd2bin(qInfo.trackTime.frame);
}
- if (copy_to_user
- ((void *) arg, &subchnl, sizeof(struct cdrom_subchnl)))
+ if (copy_to_user(argp, &subchnl, sizeof(struct cdrom_subchnl)))
return -EFAULT;
break;
case CDROMVOLCTRL: /* Volume control
* With my Aztech CD268-01A volume control does not work, I can only
turn the channels on (any value !=0) or off (value==0). Maybe it
works better with your drive */
- if (copy_from_user
- (&volctrl, (char *) arg, sizeof(volctrl)))
+ if (copy_from_user(&volctrl, argp, sizeof(volctrl)))
return -EFAULT;
azt_Play.start.min = 0x21;
azt_Play.start.sec = 0x84;
case CDROMREADCOOKED: /*read data in mode 1 (2048 Bytes) */
case CDROMREADRAW: /*read data in mode 2 (2336 Bytes) */
{
- if (copy_from_user(&msf, (void *) arg, sizeof msf))
+ if (copy_from_user(&msf, argp, sizeof msf))
return -EFAULT;
/* convert to bcd */
azt_bin2bcd(&msf.cdmsf_min0);
if (DiskInfo.xa) {
return -1; /*XA Disks can't be read raw */
} else {
- if (sendAztCmd
- (ACMD_PLAY_READ_RAW,
- &azt_Play))
+ if (sendAztCmd(ACMD_PLAY_READ_RAW, &azt_Play))
return -1;
DTEN_LOW;
- insb(DATA_PORT, buf,
- CD_FRAMESIZE_RAW);
- if (copy_to_user
- ((void *) arg, &buf,
- CD_FRAMESIZE_RAW))
+ insb(DATA_PORT, buf, CD_FRAMESIZE_RAW);
+ if (copy_to_user(argp, &buf, CD_FRAMESIZE_RAW))
return -EFAULT;
}
} else
return -1;
DTEN_LOW;
insb(DATA_PORT, buf, CD_FRAMESIZE);
- if (copy_to_user
- ((void *) arg, &buf, CD_FRAMESIZE))
+ if (copy_to_user(argp, &buf, CD_FRAMESIZE))
return -EFAULT;
}
}
break;
case CDROMSEEK: /*seek msf address */
- if (copy_from_user(&msf, (void *) arg, sizeof msf))
+ if (copy_from_user(&msf, argp, sizeof msf))
return -EFAULT;
/* convert to bcd */
azt_bin2bcd(&msf.cdmsf_min0);
printk(KERN_INFO "aztcd: (C) 1994-98 W.Zimmermann\n");
if (azt_port == -1) {
printk
- ("aztcd: KernelVersion=%s DriverVersion=%s For IDE/ATAPI-drives use ide-cd.c\n",
- UTS_RELEASE, AZT_VERSION);
+ ("aztcd: DriverVersion=%s For IDE/ATAPI-drives use ide-cd.c\n",
+ AZT_VERSION);
} else
printk
("aztcd: DriverVersion=%s BaseAddress=0x%x For IDE/ATAPI-drives use ide-cd.c\n",
release_region(azt_port, 4);
}
}
- if ((azt_port_auto[i] == 0) || (i == 16)) {
+ if ((i == 16) || (azt_port_auto[i] == 0)) {
printk(KERN_INFO "aztcd: no AZTECH CD-ROM drive found\n");
return -EIO;
}