diff options
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r-- | drivers/ide/ide-tape.c | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index a7670fbd470d..ee92ff1fb745 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -748,16 +748,6 @@ typedef struct { | |||
748 | #define IDETAPE_BUFFER_FILLING_PAGE 0x33 | 748 | #define IDETAPE_BUFFER_FILLING_PAGE 0x33 |
749 | 749 | ||
750 | /* | 750 | /* |
751 | * Mode Parameter Header for the MODE SENSE packet command | ||
752 | */ | ||
753 | typedef struct { | ||
754 | __u8 mode_data_length; /* Length of the following data transfer */ | ||
755 | __u8 medium_type; /* Medium Type */ | ||
756 | __u8 dsp; /* Device Specific Parameter */ | ||
757 | __u8 bdl; /* Block Descriptor Length */ | ||
758 | } idetape_mode_parameter_header_t; | ||
759 | |||
760 | /* | ||
761 | * Mode Parameter Block Descriptor the MODE SENSE packet command | 751 | * Mode Parameter Block Descriptor the MODE SENSE packet command |
762 | * | 752 | * |
763 | * Support for block descriptors is optional. | 753 | * Support for block descriptors is optional. |
@@ -3914,9 +3904,8 @@ static void idetape_get_mode_sense_results (ide_drive_t *drive) | |||
3914 | { | 3904 | { |
3915 | idetape_tape_t *tape = drive->driver_data; | 3905 | idetape_tape_t *tape = drive->driver_data; |
3916 | idetape_pc_t pc; | 3906 | idetape_pc_t pc; |
3917 | idetape_mode_parameter_header_t *header; | ||
3918 | idetape_capabilities_page_t *capabilities; | 3907 | idetape_capabilities_page_t *capabilities; |
3919 | 3908 | ||
3920 | idetape_create_mode_sense_cmd(&pc, IDETAPE_CAPABILITIES_PAGE); | 3909 | idetape_create_mode_sense_cmd(&pc, IDETAPE_CAPABILITIES_PAGE); |
3921 | if (idetape_queue_pc_tail(drive, &pc)) { | 3910 | if (idetape_queue_pc_tail(drive, &pc)) { |
3922 | printk(KERN_ERR "ide-tape: Can't get tape parameters - assuming some default values\n"); | 3911 | printk(KERN_ERR "ide-tape: Can't get tape parameters - assuming some default values\n"); |
@@ -3926,8 +3915,8 @@ static void idetape_get_mode_sense_results (ide_drive_t *drive) | |||
3926 | tape->capabilities.buffer_size = 6 * 52; | 3915 | tape->capabilities.buffer_size = 6 * 52; |
3927 | return; | 3916 | return; |
3928 | } | 3917 | } |
3929 | header = (idetape_mode_parameter_header_t *) pc.buffer; | 3918 | capabilities = (idetape_capabilities_page_t *) |
3930 | capabilities = (idetape_capabilities_page_t *) (pc.buffer + sizeof(idetape_mode_parameter_header_t) + header->bdl); | 3919 | (pc.buffer + 4 + pc.buffer[3]); |
3931 | 3920 | ||
3932 | capabilities->max_speed = ntohs(capabilities->max_speed); | 3921 | capabilities->max_speed = ntohs(capabilities->max_speed); |
3933 | capabilities->ctl = ntohs(capabilities->ctl); | 3922 | capabilities->ctl = ntohs(capabilities->ctl); |
@@ -3952,11 +3941,13 @@ static void idetape_get_mode_sense_results (ide_drive_t *drive) | |||
3952 | #if IDETAPE_DEBUG_INFO | 3941 | #if IDETAPE_DEBUG_INFO |
3953 | printk(KERN_INFO "ide-tape: Dumping the results of the MODE SENSE packet command\n"); | 3942 | printk(KERN_INFO "ide-tape: Dumping the results of the MODE SENSE packet command\n"); |
3954 | printk(KERN_INFO "ide-tape: Mode Parameter Header:\n"); | 3943 | printk(KERN_INFO "ide-tape: Mode Parameter Header:\n"); |
3955 | printk(KERN_INFO "ide-tape: Mode Data Length - %d\n",header->mode_data_length); | 3944 | printk(KERN_INFO "ide-tape: Mode Data Length - %d\n", pc.buffer[0]); |
3956 | printk(KERN_INFO "ide-tape: Medium Type - %d\n",header->medium_type); | 3945 | printk(KERN_INFO "ide-tape: Medium Type - %d\n", pc.buffer[1]); |
3957 | printk(KERN_INFO "ide-tape: Device Specific Parameter - %d\n",header->dsp); | 3946 | printk(KERN_INFO "ide-tape: Device Specific Parameter - %d\n", |
3958 | printk(KERN_INFO "ide-tape: Block Descriptor Length - %d\n",header->bdl); | 3947 | pc.buffer[2]); |
3959 | 3948 | printk(KERN_INFO "ide-tape: Block Descriptor Length - %d\n", | |
3949 | pc.buffer[3]); | ||
3950 | |||
3960 | printk(KERN_INFO "ide-tape: Capabilities and Mechanical Status Page:\n"); | 3951 | printk(KERN_INFO "ide-tape: Capabilities and Mechanical Status Page:\n"); |
3961 | printk(KERN_INFO "ide-tape: Page code - %d\n",capabilities->page_code); | 3952 | printk(KERN_INFO "ide-tape: Page code - %d\n",capabilities->page_code); |
3962 | printk(KERN_INFO "ide-tape: Page length - %d\n",capabilities->page_length); | 3953 | printk(KERN_INFO "ide-tape: Page length - %d\n",capabilities->page_length); |
@@ -3989,9 +3980,8 @@ static void idetape_get_blocksize_from_block_descriptor(ide_drive_t *drive) | |||
3989 | 3980 | ||
3990 | idetape_tape_t *tape = drive->driver_data; | 3981 | idetape_tape_t *tape = drive->driver_data; |
3991 | idetape_pc_t pc; | 3982 | idetape_pc_t pc; |
3992 | idetape_mode_parameter_header_t *header; | ||
3993 | idetape_parameter_block_descriptor_t *block_descrp; | 3983 | idetape_parameter_block_descriptor_t *block_descrp; |
3994 | 3984 | ||
3995 | idetape_create_mode_sense_cmd(&pc, IDETAPE_BLOCK_DESCRIPTOR); | 3985 | idetape_create_mode_sense_cmd(&pc, IDETAPE_BLOCK_DESCRIPTOR); |
3996 | if (idetape_queue_pc_tail(drive, &pc)) { | 3986 | if (idetape_queue_pc_tail(drive, &pc)) { |
3997 | printk(KERN_ERR "ide-tape: Can't get block descriptor\n"); | 3987 | printk(KERN_ERR "ide-tape: Can't get block descriptor\n"); |
@@ -4001,10 +3991,9 @@ static void idetape_get_blocksize_from_block_descriptor(ide_drive_t *drive) | |||
4001 | } | 3991 | } |
4002 | return; | 3992 | return; |
4003 | } | 3993 | } |
4004 | header = (idetape_mode_parameter_header_t *) pc.buffer; | 3994 | block_descrp = (idetape_parameter_block_descriptor_t *)(pc.buffer + 4); |
4005 | block_descrp = (idetape_parameter_block_descriptor_t *) (pc.buffer + sizeof(idetape_mode_parameter_header_t)); | ||
4006 | tape->tape_block_size =( block_descrp->length[0]<<16) + (block_descrp->length[1]<<8) + block_descrp->length[2]; | 3995 | tape->tape_block_size =( block_descrp->length[0]<<16) + (block_descrp->length[1]<<8) + block_descrp->length[2]; |
4007 | tape->drv_write_prot = (header->dsp & 0x80) >> 7; | 3996 | tape->drv_write_prot = (pc.buffer[2] & 0x80) >> 7; |
4008 | 3997 | ||
4009 | #if IDETAPE_DEBUG_INFO | 3998 | #if IDETAPE_DEBUG_INFO |
4010 | printk(KERN_INFO "ide-tape: Adjusted block size - %d\n", tape->tape_block_size); | 3999 | printk(KERN_INFO "ide-tape: Adjusted block size - %d\n", tape->tape_block_size); |