遵循 bus-> ide_bus->ide光驱 -> ide_sony_光驱的 方向
J:\sdb1\_xfile\2013_all_iso\_xfile_2013_10\rhel4_chm_kernel_2.6.9_\_linux-2.6.9.chm
2423 struct bus_type ide_bus_type = {
2424 .name = "ide",
2425 .suspend = generic_ide_suspend,
2426 .resume = generic_ide_resume,
2427 };
2410 struct block_device_operations ide_fops[] = {{
2411 .owner = THIS_MODULE,
2412 .open = ide_open,
2413 }};
2432 int __init ide_init (void)
2438 bus_register(&ide_bus_type);
#==========================================================================
#ide注册 不同的 设备 cd disk floppy ide-tape ide-scsi
ide_register_driver
#定义: drivers/ide/ide.c EXPORT_SYMBOL(ide_register_driver);
drivers/ide/ide-cd.c ide_register_driver(&ide_cdrom_driver);
drivers/ide/ide-disk.c return ide_register_driver(&idedisk_driver);
drivers/ide/ide-floppy.c ide_register_driver(&idefloppy_driver);
drivers/ide/ide-tape.c ide_register_driver(&idetape_driver);
drivers/scsi/ide-scsi.c return ide_register_driver(&idescsi_driver);
########################################################################
#ide 光驱
3425 static struct block_device_operations idecd_ops = {
3426 .owner = THIS_MODULE,
3427 .open = idecd_open,
3428 .release = idecd_release,
3429 .ioctl = idecd_ioctl,
3430 .media_changed = idecd_media_changed,
3431 .revalidate_disk= idecd_revalidate_disk
3432 };
#这里是 光驱的抽象层
idecd_ioctl,
generic_ide_ioctl(file, bdev, cmd, arg);
cdrom_ioctl(file, &info->devinfo, inode, cmd, arg);
#==========================================================================
scsi_cmd_ioctl(file, ip->i_bdev->bd_disk, cmd, (void __user *)arg);
2124 case CDROMMULTISESSION: {
2130 IOCTL_IN(arg, struct cdrom_multisession, ms_info);
2140 IOCTL_OUT(arg, struct cdrom_multisession, ms_info);
2145 case CDROMEJECT: {
cdo->lock_door(cdi, 0)))
2158 case CDROMCLOSETRAY: {
2165 case CDROMEJECT_SW: {
2177 case CDROM_MEDIA_CHANGED: {
2206 case CDROM_SET_OPTIONS: {
2211 case CDO_USE_FFLAGS:
2212 case CDO_CHECK_TYPE:
2214 case CDO_LOCK:
2218 case 0:
2229 case CDROM_CLEAR_OPTIONS: {
2235 case CDROM_SELECT_SPEED: {
2242 case CDROM_SELECT_DISC: {
2264 case CDROMRESET: {
2274 case CDROM_LOCKDOOR: {
2286 case CDROM_DEBUG: {
2294 case CDROM_GET_CAPABILITY: {
2304 case CDROM_GET_MCN: {
2311 IOCTL_OUT(arg, struct cdrom_mcn, mcn);
2316 case CDROM_DRIVE_STATUS: {
2332 while this is often the case, it is also very common for CDs to
2346 case CDROM_DISC_STATUS: {
2369 case CDROM_CHANGER_NSLOTS: {
2390 case CDROMSUBCHNL: {
2396 IOCTL_IN(arg, struct cdrom_subchnl, q);
2407 IOCTL_OUT(arg, struct cdrom_subchnl, q);
2411 case CDROMREADTOCHDR: {
2416 IOCTL_IN(arg, struct cdrom_tochdr, header);
2419 IOCTL_OUT(arg, struct cdrom_tochdr, header);
2423 case CDROMREADTOCENTRY: {
2429 IOCTL_IN(arg, struct cdrom_tocentry, entry);
2440 IOCTL_OUT(arg, struct cdrom_tocentry, entry);
2444 case CDROMPLAYMSF: {
2448 cdinfo(CD_DO_IOCTL, "entering CDROMPLAYMSF\n");
2449 IOCTL_IN(arg, struct cdrom_msf, msf);
2452 case CDROMPLAYTRKIND: {
2456 cdinfo(CD_DO_IOCTL, "entering CDROMPLAYTRKIND\n");
2457 IOCTL_IN(arg, struct cdrom_ti, ti);
2461 case CDROMVOLCTRL: {
2465 cdinfo(CD_DO_IOCTL, "entering CDROMVOLCTRL\n");
2466 IOCTL_IN(arg, struct cdrom_volctrl, volume);
2469 case CDROMVOLREAD: {
2473 cdinfo(CD_DO_IOCTL, "entering CDROMVOLREAD\n");
2476 IOCTL_OUT(arg, struct cdrom_volctrl, volume);
2479 case CDROMSTART:
2480 case CDROMSTOP:
2481 case CDROMPAUSE:
2482 case CDROMRESUME: {
2485 cdinfo(CD_DO_IOCTL, "doing audio ioctl (start/stop/pause/resume)\n");
2492 if (CDROM_CAN(CDC_IOCTLS))
########################################################################
#sony 光驱
root/drivers/cdrom/cdu31a.c
3139 static struct cdrom_device_ops scd_dops = {
3140 .open = scd_open,
3141 .release = scd_release,
3142 .drive_status = scd_drive_status,
3143 .media_changed = scd_media_changed,
3144 .tray_move = scd_tray_move,
3145 .lock_door = scd_lock_door,
3146 .select_speed = scd_select_speed,
3147 .get_last_session = scd_get_last_session,
3148 .get_mcn = scd_get_mcn,
3149 .reset = scd_reset,
3150 .audio_ioctl = scd_audio_ioctl,
3151 .dev_ioctl = scd_dev_ioctl,
3152 .capability = CDC_OPEN_TRAY | CDC_CLOSE_TRAY | CDC_LOCK |
3153 CDC_SELECT_SPEED | CDC_MULTI_SESSION |
3154 CDC_MULTI_SESSION | CDC_MCN |
3155 CDC_MEDIA_CHANGED | CDC_PLAY_AUDIO |
3156 CDC_RESET | CDC_IOCTLS | CDC_DRIVE_STATUS,
3157 .n_minors = 1,
3158 };
scd_dev_ioctl
case CDROMSTART: /* Spin up the drive */
return do_sony_cd_cmd_chk("START", SONY_SPIN_UP_CMD, NULL,
case CDROMSTOP: /* Spin down the drive */
do_sony_cd_cmd(SONY_AUDIO_STOP_CMD, NULL, 0, res_reg,
return do_sony_cd_cmd_chk("STOP", SONY_SPIN_DOWN_CMD, NULL,
case CDROMPAUSE: /* Pause the drive */
case CDROMRESUME: /* Start the drive after being paused */
do_sony_cd_cmd(SONY_SPIN_UP_CMD, NULL, 0, res_reg,
case CDROMPLAYMSF: /* Play starting at the given MSF address. */
do_sony_cd_cmd(SONY_SPIN_UP_CMD, NULL, 0, res_reg,
case CDROMREADTOCHDR: /* Read the table of contents header */
case CDROMREADTOCENTRY: /* Read a given table of contents entry */
case CDROMPLAYTRKIND: /* Play a track. This currently ignores index. */
do_sony_cd_cmd(SONY_SPIN_UP_CMD, NULL, 0, res_reg,
do_sony_cd_cmd(SONY_AUDIO_PLAYBACK_CMD, params, 7,
case CDROMVOLCTRL: /* Volume control. What volume does this change, anyway? */
do_sony_cd_cmd_chk("VOLCTRL",
case CDROMSUBCHNL: /* Get subchannel info */
#--------------------------------------------------------------------------
do_sony_cd_cmd
write_params(params, num_params);
write_param(*params);
outb(param, sony_cd_param_reg);
write_cmd(cmd);
outb(curr_control_reg | SONY_RES_RDY_INT_EN_BIT,sony_cd_control_reg);
outb(cmd, sony_cd_cmd_reg);
J:\sdb1\_xfile\2013_all_iso\_xfile_2013_10\rhel4_chm_kernel_2.6.9_\_linux-2.6.9.chm
2423 struct bus_type ide_bus_type = {
2424 .name = "ide",
2425 .suspend = generic_ide_suspend,
2426 .resume = generic_ide_resume,
2427 };
2410 struct block_device_operations ide_fops[] = {{
2411 .owner = THIS_MODULE,
2412 .open = ide_open,
2413 }};
2432 int __init ide_init (void)
2438 bus_register(&ide_bus_type);
#==========================================================================
#ide注册 不同的 设备 cd disk floppy ide-tape ide-scsi
ide_register_driver
#定义: drivers/ide/ide.c EXPORT_SYMBOL(ide_register_driver);
drivers/ide/ide-cd.c ide_register_driver(&ide_cdrom_driver);
drivers/ide/ide-disk.c return ide_register_driver(&idedisk_driver);
drivers/ide/ide-floppy.c ide_register_driver(&idefloppy_driver);
drivers/ide/ide-tape.c ide_register_driver(&idetape_driver);
drivers/scsi/ide-scsi.c return ide_register_driver(&idescsi_driver);
########################################################################
#ide 光驱
3425 static struct block_device_operations idecd_ops = {
3426 .owner = THIS_MODULE,
3427 .open = idecd_open,
3428 .release = idecd_release,
3429 .ioctl = idecd_ioctl,
3430 .media_changed = idecd_media_changed,
3431 .revalidate_disk= idecd_revalidate_disk
3432 };
#这里是 光驱的抽象层
idecd_ioctl,
generic_ide_ioctl(file, bdev, cmd, arg);
cdrom_ioctl(file, &info->devinfo, inode, cmd, arg);
#==========================================================================
scsi_cmd_ioctl(file, ip->i_bdev->bd_disk, cmd, (void __user *)arg);
2124 case CDROMMULTISESSION: {
2130 IOCTL_IN(arg, struct cdrom_multisession, ms_info);
2140 IOCTL_OUT(arg, struct cdrom_multisession, ms_info);
2145 case CDROMEJECT: {
cdo->lock_door(cdi, 0)))
2158 case CDROMCLOSETRAY: {
2165 case CDROMEJECT_SW: {
2177 case CDROM_MEDIA_CHANGED: {
2206 case CDROM_SET_OPTIONS: {
2211 case CDO_USE_FFLAGS:
2212 case CDO_CHECK_TYPE:
2214 case CDO_LOCK:
2218 case 0:
2229 case CDROM_CLEAR_OPTIONS: {
2235 case CDROM_SELECT_SPEED: {
2242 case CDROM_SELECT_DISC: {
2264 case CDROMRESET: {
2274 case CDROM_LOCKDOOR: {
2286 case CDROM_DEBUG: {
2294 case CDROM_GET_CAPABILITY: {
2304 case CDROM_GET_MCN: {
2311 IOCTL_OUT(arg, struct cdrom_mcn, mcn);
2316 case CDROM_DRIVE_STATUS: {
2332 while this is often the case, it is also very common for CDs to
2346 case CDROM_DISC_STATUS: {
2369 case CDROM_CHANGER_NSLOTS: {
2390 case CDROMSUBCHNL: {
2396 IOCTL_IN(arg, struct cdrom_subchnl, q);
2407 IOCTL_OUT(arg, struct cdrom_subchnl, q);
2411 case CDROMREADTOCHDR: {
2416 IOCTL_IN(arg, struct cdrom_tochdr, header);
2419 IOCTL_OUT(arg, struct cdrom_tochdr, header);
2423 case CDROMREADTOCENTRY: {
2429 IOCTL_IN(arg, struct cdrom_tocentry, entry);
2440 IOCTL_OUT(arg, struct cdrom_tocentry, entry);
2444 case CDROMPLAYMSF: {
2448 cdinfo(CD_DO_IOCTL, "entering CDROMPLAYMSF\n");
2449 IOCTL_IN(arg, struct cdrom_msf, msf);
2452 case CDROMPLAYTRKIND: {
2456 cdinfo(CD_DO_IOCTL, "entering CDROMPLAYTRKIND\n");
2457 IOCTL_IN(arg, struct cdrom_ti, ti);
2461 case CDROMVOLCTRL: {
2465 cdinfo(CD_DO_IOCTL, "entering CDROMVOLCTRL\n");
2466 IOCTL_IN(arg, struct cdrom_volctrl, volume);
2469 case CDROMVOLREAD: {
2473 cdinfo(CD_DO_IOCTL, "entering CDROMVOLREAD\n");
2476 IOCTL_OUT(arg, struct cdrom_volctrl, volume);
2479 case CDROMSTART:
2480 case CDROMSTOP:
2481 case CDROMPAUSE:
2482 case CDROMRESUME: {
2485 cdinfo(CD_DO_IOCTL, "doing audio ioctl (start/stop/pause/resume)\n");
2492 if (CDROM_CAN(CDC_IOCTLS))
########################################################################
#sony 光驱
root/drivers/cdrom/cdu31a.c
3139 static struct cdrom_device_ops scd_dops = {
3140 .open = scd_open,
3141 .release = scd_release,
3142 .drive_status = scd_drive_status,
3143 .media_changed = scd_media_changed,
3144 .tray_move = scd_tray_move,
3145 .lock_door = scd_lock_door,
3146 .select_speed = scd_select_speed,
3147 .get_last_session = scd_get_last_session,
3148 .get_mcn = scd_get_mcn,
3149 .reset = scd_reset,
3150 .audio_ioctl = scd_audio_ioctl,
3151 .dev_ioctl = scd_dev_ioctl,
3152 .capability = CDC_OPEN_TRAY | CDC_CLOSE_TRAY | CDC_LOCK |
3153 CDC_SELECT_SPEED | CDC_MULTI_SESSION |
3154 CDC_MULTI_SESSION | CDC_MCN |
3155 CDC_MEDIA_CHANGED | CDC_PLAY_AUDIO |
3156 CDC_RESET | CDC_IOCTLS | CDC_DRIVE_STATUS,
3157 .n_minors = 1,
3158 };
scd_dev_ioctl
case CDROMSTART: /* Spin up the drive */
return do_sony_cd_cmd_chk("START", SONY_SPIN_UP_CMD, NULL,
case CDROMSTOP: /* Spin down the drive */
do_sony_cd_cmd(SONY_AUDIO_STOP_CMD, NULL, 0, res_reg,
return do_sony_cd_cmd_chk("STOP", SONY_SPIN_DOWN_CMD, NULL,
case CDROMPAUSE: /* Pause the drive */
case CDROMRESUME: /* Start the drive after being paused */
do_sony_cd_cmd(SONY_SPIN_UP_CMD, NULL, 0, res_reg,
case CDROMPLAYMSF: /* Play starting at the given MSF address. */
do_sony_cd_cmd(SONY_SPIN_UP_CMD, NULL, 0, res_reg,
case CDROMREADTOCHDR: /* Read the table of contents header */
case CDROMREADTOCENTRY: /* Read a given table of contents entry */
case CDROMPLAYTRKIND: /* Play a track. This currently ignores index. */
do_sony_cd_cmd(SONY_SPIN_UP_CMD, NULL, 0, res_reg,
do_sony_cd_cmd(SONY_AUDIO_PLAYBACK_CMD, params, 7,
case CDROMVOLCTRL: /* Volume control. What volume does this change, anyway? */
do_sony_cd_cmd_chk("VOLCTRL",
case CDROMSUBCHNL: /* Get subchannel info */
#--------------------------------------------------------------------------
do_sony_cd_cmd
write_params(params, num_params);
write_param(*params);
outb(param, sony_cd_param_reg);
write_cmd(cmd);
outb(curr_control_reg | SONY_RES_RDY_INT_EN_BIT,sony_cd_control_reg);
outb(cmd, sony_cd_cmd_reg);