diff options
| -rw-r--r-- | drivers/ide/ide-tape.c | 50 |
1 files changed, 18 insertions, 32 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 64d46fef2602..3c516ff1adf0 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
| @@ -571,24 +571,6 @@ struct idetape_id_gcw { | |||
| 571 | unsigned protocol :2; /* Protocol type */ | 571 | unsigned protocol :2; /* Protocol type */ |
| 572 | }; | 572 | }; |
| 573 | 573 | ||
| 574 | /* | ||
| 575 | * READ POSITION packet command - Data Format (From Table 6-57) | ||
| 576 | */ | ||
| 577 | typedef struct { | ||
| 578 | unsigned reserved0_10 :2; /* Reserved */ | ||
| 579 | unsigned bpu :1; /* Block Position Unknown */ | ||
| 580 | unsigned reserved0_543 :3; /* Reserved */ | ||
| 581 | unsigned eop :1; /* End Of Partition */ | ||
| 582 | unsigned bop :1; /* Beginning Of Partition */ | ||
| 583 | u8 partition; /* Partition Number */ | ||
| 584 | u8 reserved2, reserved3; /* Reserved */ | ||
| 585 | u32 first_block; /* First Block Location */ | ||
| 586 | u32 last_block; /* Last Block Location (Optional) */ | ||
| 587 | u8 reserved12; /* Reserved */ | ||
| 588 | u8 blocks_in_buffer[3]; /* Blocks In Buffer - (Optional) */ | ||
| 589 | u32 bytes_in_buffer; /* Bytes In Buffer (Optional) */ | ||
| 590 | } idetape_read_position_result_t; | ||
| 591 | |||
| 592 | /* Structures related to the SELECT SENSE / MODE SENSE packet commands. */ | 574 | /* Structures related to the SELECT SENSE / MODE SENSE packet commands. */ |
| 593 | #define IDETAPE_BLOCK_DESCRIPTOR 0 | 575 | #define IDETAPE_BLOCK_DESCRIPTOR 0 |
| 594 | #define IDETAPE_CAPABILITIES_PAGE 0x2a | 576 | #define IDETAPE_CAPABILITIES_PAGE 0x2a |
| @@ -2000,30 +1982,34 @@ static void idetape_wait_for_request (ide_drive_t *drive, struct request *rq) | |||
| 2000 | spin_lock_irq(&tape->spinlock); | 1982 | spin_lock_irq(&tape->spinlock); |
| 2001 | } | 1983 | } |
| 2002 | 1984 | ||
| 2003 | static ide_startstop_t idetape_read_position_callback (ide_drive_t *drive) | 1985 | static ide_startstop_t idetape_read_position_callback(ide_drive_t *drive) |
| 2004 | { | 1986 | { |
| 2005 | idetape_tape_t *tape = drive->driver_data; | 1987 | idetape_tape_t *tape = drive->driver_data; |
| 2006 | idetape_read_position_result_t *result; | 1988 | u8 *readpos = tape->pc->buffer; |
| 2007 | 1989 | ||
| 2008 | debug_log(DBG_PROCS, "Enter %s\n", __func__); | 1990 | debug_log(DBG_PROCS, "Enter %s\n", __func__); |
| 2009 | 1991 | ||
| 2010 | if (!tape->pc->error) { | 1992 | if (!tape->pc->error) { |
| 2011 | result = (idetape_read_position_result_t *) tape->pc->buffer; | 1993 | debug_log(DBG_SENSE, "BOP - %s\n", |
| 2012 | debug_log(DBG_SENSE, "BOP - %s\n", result->bop ? "Yes" : "No"); | 1994 | (readpos[0] & 0x80) ? "Yes" : "No"); |
| 2013 | debug_log(DBG_SENSE, "EOP - %s\n", result->eop ? "Yes" : "No"); | 1995 | debug_log(DBG_SENSE, "EOP - %s\n", |
| 2014 | 1996 | (readpos[0] & 0x40) ? "Yes" : "No"); | |
| 2015 | if (result->bpu) { | 1997 | |
| 2016 | printk(KERN_INFO "ide-tape: Block location is unknown to the tape\n"); | 1998 | if (readpos[0] & 0x4) { |
| 1999 | printk(KERN_INFO "ide-tape: Block location is unknown" | ||
| 2000 | "to the tape\n"); | ||
| 2017 | clear_bit(IDETAPE_ADDRESS_VALID, &tape->flags); | 2001 | clear_bit(IDETAPE_ADDRESS_VALID, &tape->flags); |
| 2018 | idetape_end_request(drive, 0, 0); | 2002 | idetape_end_request(drive, 0, 0); |
| 2019 | } else { | 2003 | } else { |
| 2020 | debug_log(DBG_SENSE, "Block Location - %u\n", | 2004 | debug_log(DBG_SENSE, "Block Location - %u\n", |
| 2021 | ntohl(result->first_block)); | 2005 | be32_to_cpu(*(u32 *)&readpos[4])); |
| 2022 | 2006 | ||
| 2023 | tape->partition = result->partition; | 2007 | tape->partition = readpos[1]; |
| 2024 | tape->first_frame_position = ntohl(result->first_block); | 2008 | tape->first_frame_position = |
| 2025 | tape->last_frame_position = ntohl(result->last_block); | 2009 | be32_to_cpu(*(u32 *)&readpos[4]); |
| 2026 | tape->blocks_in_buffer = result->blocks_in_buffer[2]; | 2010 | tape->last_frame_position = |
| 2011 | be32_to_cpu(*(u32 *)&readpos[8]); | ||
| 2012 | tape->blocks_in_buffer = readpos[15]; | ||
| 2027 | set_bit(IDETAPE_ADDRESS_VALID, &tape->flags); | 2013 | set_bit(IDETAPE_ADDRESS_VALID, &tape->flags); |
| 2028 | idetape_end_request(drive, 1, 0); | 2014 | idetape_end_request(drive, 1, 0); |
| 2029 | } | 2015 | } |
