1. 27 1月, 2008 10 次提交
  2. 26 1月, 2008 23 次提交
    • B
      ide: cleanup ide_set_dma() · 7b905994
      Bartlomiej Zolnierkiewicz 提交于
      * ->dma_off_quietly is always called before ide_set_dma()
        so the call can be moved inside ide_set_dma().
      
      * ide_dma_check() doesn't touch hardware so ->dma_off_quietly
        call for 'rc == -1' case is redundant, remove it.
      
      * '0' and '-1' are the only values returned by ide_dma_check()
        so remove dead code for other cases.
      
      There should be no functionality changes caused by this patch.
      Acked-by: NSergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      7b905994
    • B
      ide: add ide_tf_read() helper · c2b57cdc
      Bartlomiej Zolnierkiewicz 提交于
      * Factor out code reading taskfile registers from ide_end_drive_cmd()
        to the new ide_tf_read() helper.
      
      * Add IDE_TFLAG_IN_* taskfile flags to indicate the need to load
        particular IDE taskfile register in ide_tf_read().
      
      * Update ide_end_drive_cmd() to set respective IDE_TFLAG_IN_* taksfile flags.
      
      * Add ide_get_lba_addr() for getting LBA sector address from taskfile struct.
      
      * Factor out code getting sector address from ide_dump_ata_status()
        to the new ide_dump_sector() function.
      
      * Convert ide_dump_sector() to use ide_tf_read() and ide_get_lba_addr().
      
      * Remove no longer needed ide_read_24().
      
      The only change in functionality caused by this patch is that
      ide_dump_ata_status() no longer prints "high"/"low" parts of LBA48
      sector address (of course LBA48 sector address is still printed).
      
      Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      c2b57cdc
    • B
      ide: remove 'handler' field from ide_task_t (take 2) · 57d7366b
      Bartlomiej Zolnierkiewicz 提交于
      * Add IDE_TFLAG_CUSTOM_HANDLER taskfile flag and use it for internal requests
        which require custom handlers.  Check the flag in do_rw_taskfile() and set
        handler accordingly.
      
      * Cleanup ide_init_{specify,restore,setmult}_cmd() and rename it to
        ide_tf_set_{specify,restore,setmult}_cmd().
      
      * Make {set_geometry,recal,set_multmode}_intr() static.
      
      * Remove no longer needed 'handler' field from ide_task_t.
      
      v2:
      * 'handler' in do_rw_taskfile() must be set to NULL initially.
      
      There should be no functionality changes caused by this patch.
      Acked-by: NSergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      57d7366b
    • B
      ide: use ->data_phase to set ->handler in do_rw_taskfile() · 1192e528
      Bartlomiej Zolnierkiewicz 提交于
      * Use ->data_phase to set ->handler in do_rw_taskfile() instead of
        setting ->handler in callers of ide_raw_taskfile()/do_rw_taskfile().
      
      * Unexport task_no_data_intr() and make it static.
      
      There should be no functionality changes caused by this patch.
      Acked-by: NSergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      1192e528
    • B
      ide: merge flagged_taskfile() into do_rw_taskfile() · 1edee60e
      Bartlomiej Zolnierkiewicz 提交于
      Based on the earlier work by Tejun Heo.
      
      task->data_phase == TASKFILE_MULTI_{IN,OUT} vs drive->mult_count == 0
      check is needed also for ide_taskfile_ioctl() requests that don't have
      IDE_TFLAG_FLAGGED taskfile flag set.
      
      Cc: Tejun Heo <htejun@gmail.com>
      Acked-by: NSergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      1edee60e
    • B
      ide: remove 'tf_in_flags' field from ide_task_t · 866e2ec9
      Bartlomiej Zolnierkiewicz 提交于
      * Add IDE_TFLAG_IN_DATA taskfile flag to indicate the need of reading
        IDE_DATA_REG in ide_end_drive_cmd().
      
        Set the new flag in ide_taskfile_ioctl() if ->in_flags.b.data is set.
      
      * Add IDE_TFLAG_FLAGGED_SET_IN_FLAGS taskfile flag to indicate the
        need of modifying ->in_flags in ide_taskfile_ioctl().
      
        Set the new flag in flagged_taskfile() and move the code modifying
        ->tf_in_flags to ide_taskfile_ioctl().
      
        While at it remove the bogus comment: ->tf_in_flags (except .b.data)
        have no effect on selection of registers to read.
      
      * Remove no longer needed 'tf_in_flags' field from ide_task_t.
      
      As the result we finally have the internals of HDIO_DRIVE_TASKFILE ioctl
      separated from the core IDE code.
      
      There should be no functionality changes caused by this patch.
      Acked-by: NSergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      866e2ec9
    • B
      ide: remove 'command_type' field from ide_task_t · ac026ff2
      Bartlomiej Zolnierkiewicz 提交于
      * Add 'data_buf' and 'nsect' variables in ide_taskfile_ioctl()
        to cache data buffer pointer and number of sectors to transfer
        (this allows us to have only one ide_diag_taskfile() call).
      
      * Add IDE_TFLAG_WRITE taskfile flag and use it to check whether
        the REQ_RW request flag should be set.
      
      * Move ->command_type handling from ide_diag_taskfile() to
        ide_taskfile_ioctl() and use ->req_cmd instead of ->command_type.
      
      * Add 'nsect' parameter to ide_raw_taskfile().
      
      * Merge ide_diag_taskfile() into ide_raw_taskfile().
      
      * Initialize ->data_phase explicitly in idedisk_prepare_flush(),
        ide_start_power_step() and ide_disk_special().
      
      * Remove no longer needed 'command_type' field from ide_task_t.
      
      * Add #ifndef/#endif __KERNEL__ to <linux/hdreg.h> around no
        longer used by kernel IDE_DRIVE_TASK_* and TASKFILE_* defines.
      
      There should be no functionality changes caused by this patch.
      Acked-by: NSergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      ac026ff2
    • B
      ide: remove hwif->intrproc · 7299a391
      Bartlomiej Zolnierkiewicz 提交于
      Given that:
      
      * hpt366.c::hpt3xx_intrproc() is the only user of hwif->intrproc
      
      * hpt366.c::hpt3xx_quirkproc() sets drive->quirk_list to 1 for quirky drives
        which is a value unique to hpt366 host driver
      
      we can remove hwif->intproc and just check for drive->quirk_list == 1
      in ide_do_request().
      Acked-by: NSergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      7299a391
    • B
    • B
      ide: add ide_pktcmd_tf_load() helper · 2fc57388
      Bartlomiej Zolnierkiewicz 提交于
      Add ide_pktcmd_tf_load() helper and convert ATAPI device drivers to use it.
      
      There should be no functionality changes caused by this patch.
      Acked-by: NSergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      2fc57388
    • B
      ide: remove REQ_TYPE_ATA_TASK · 29ed2a5f
      Bartlomiej Zolnierkiewicz 提交于
      Based on the earlier work by Tejun Heo.
      
      All users are gone so we can finally remove it.
      
      Cc: Tejun Heo <htejun@gmail.com>
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      29ed2a5f
    • B
      ide: extend timeout for REQ_TYPE_ATA_{CMD,TASK} requests · 1f2564b8
      Bartlomiej Zolnierkiewicz 提交于
      Extend timeout for REQ_TYPE_ATA_{CMD,TASK} requests from WAIT_CMD (10sec)
      to WAIT_WORSTCASE (30sec, already used for REQ_TYPE_ATA_TASKFILE).
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      1f2564b8
    • B
      ide: remove unnecessary writes to HOB taskfile registers · a3bbb9d8
      Bartlomiej Zolnierkiewicz 提交于
      * Set taskfile flags for REQ_TYPE_ATA_TASKFILE requests before
        adding the request to the queue.
      
      * Cleanup execute_drive_cmd().
      
      * Remove unnecessary writes to HOB taskfile registers when using
        LBA48 disk for the following cases:
      
        - Power Management requests
          (WIN_FLUSH_CACHE[_EXT], WIN_STANDBYNOW1, WIN_IDLEIMMEDIATE commands)
      
        - special commands (WIN_SPECIFY, WIN_RESTORE, WIN_SETMULT)
      
        - Host Protected Area support (WIN_READ_NATIVE_MAX, WIN_SET_MAX)
      
        - /proc/ide/ SMART support (WIN_SMART with SMART_ENABLE,
          SMART_READ_VALUES and SMART_READ_THRESHOLDS subcommands)
      
        - write cache enabling/disabling in ide-disk
          (WIN_SETFEATURES with SETFEATURES_{EN,DIS}_WCACHE)
      
        - write cache flushing in ide-disk (WIN_FLUSH_CACHE[_EXT])
      
        - acoustic management in ide-disk
          (WIN_SETFEATURES with SETFEATURES_{EN,DIS}_AAM)
      
        - door (un)locking in ide-disk (WIN_DOORLOCK, WIN_DOORUNLOCK)
      
        - /proc/ide/hd?/identify support (WIN_IDENTIFY)
      
        - ACPI _GTF taskfiles
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      a3bbb9d8
    • B
      ide: use IDE_TFLAG_LBA48 for REQ_TYPE_ATA_TASKFILE requests · 868e672a
      Bartlomiej Zolnierkiewicz 提交于
      * Use IDE_TFLAG_LBA48 for REQ_TYPE_ATA_TASKFILE requests in ide_end_drive_cmd()
        to decide whether we need to read HOB taskfile registers.
      
      * Update execute_drive_cmd() accordingly.
      
      This is a preparation for the next patch which removes unnecessary writes to
      HOB taskfile registers for some ATA commands.
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      868e672a
    • B
      ide: use ide_tf_load() in execute_drive_cmd() · 807e35d6
      Bartlomiej Zolnierkiewicz 提交于
      * Add IDE_TFLAG_OUT_DEVICE taskfile flag to indicate the need of writing
        the Device register and handle it in ide_tf_load().
      
        Update ide_tf_load() and {do_rw,flagged}_taskfile() users accordingly.
      
      * Use struct ide_taskfile and ide_tf_load() in execute_drive_cmd().
      
      * Make the debugging code dump all taskfile registers for both
        REQ_ATA_TYPE_{CMD,TASK} requests and move it to ide_tf_load()
        so it also covers REQ_ATA_TYPE_TASKFILE requests.
      
      There should be no functionality changes caused by this patch
      (unless DEBUG is defined).
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      807e35d6
    • B
      ide: remove ide_cmd() helper · 54688aa3
      Bartlomiej Zolnierkiewicz 提交于
      * Remove ide_cmd() helper.
      
      * Clear nIEN and call SELECT_MASK() before writing taskfile registers.
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      54688aa3
    • B
      ide: execute_drive_cmd() cleanup · 21d535c9
      Bartlomiej Zolnierkiewicz 提交于
      * Rename 'args' variable in 'if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE)'
        block to 'task'.
      
      * execute_drive_cmd() is used only for REQ_TYPE_ATA_{CMD,TASK,TASKFILE} so
        we can move the common code out from 'if (rq->cmd_type == REQ_TYPE_ATA_CMD)'
        and 'if (rq->cmd_type == REQ_TYPE_ATA_TASK)' blocks.
      
      There should be no functionality changes caused by this patch.
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      21d535c9
    • B
      ide: fix registers loading order for IDE_NSECTOR_REG in execute_drive_cmd() · 6dd87233
      Bartlomiej Zolnierkiewicz 提交于
      Move loading of IDE_NSECTOR_REG from ide_cmd() to execute_drive_cmd()
      (load the IDE_NSECTOR_REG just after IDE_FEATURE_REG).
      
      This also allows us to drop 'nsect' argument from ide_cmd() and simplify
      execute_drive_cmd() code for REQ_TYPE_ATA_CMD case a bit.
      
      It shouldn't affect anything (just a usual paranoia to separate changes
      which change the way in which hardware is accessed from code cleanups).
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      6dd87233
    • B
      ide: fix registers loading order for WIN_SMART in execute_drive_cmd() · 46f26c36
      Bartlomiej Zolnierkiewicz 提交于
      Fix registers loading order for REQ_TYPE_ATA_CMD request with WIN_SMART
      command in execute_drive_cmd() (load IDE_FEATURE_REG and IDE_SECTOR_REG
      before loading IDE_LCYL_REG and IDE_HCYL_REG).
      
      It shouldn't affect anything (just a usual paranoia to separate changes
      which change the way in which hardware is accessed from code cleanups).
      Acked-by: NSergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      46f26c36
    • B
      ide: remove stale ide.h "configuration options" · 4ee06b7e
      Bartlomiej Zolnierkiewicz 提交于
      Remove stale ide.h "configuration options":
      
      * INITIAL_MULT_COUNT - always defined to 0
      
      * SUPPORT_SLOW_DATA_PORTS - unused
      
      * OK_TO_RESET_CONTROLLER - always defined to 1
      
      * DISABLE_IRQ_NOSYNC - always defined to 0
      
      Leave SUPPORT_VLB_SYNC (defined to 0 for CRIS and FRV, otherwise to 1)
      for now but disallow overriding it by <asm/ide.h>.
      
      There should be no functionality changes caused by this patch.
      Acked-by: NSergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      4ee06b7e
    • B
      ide: use do_rw_taskfile() in flagged_taskfile() · 74095a91
      Bartlomiej Zolnierkiewicz 提交于
      Based on the earlier work by Tejun Heo.
      
      * Move setting IDE_TFLAG_LBA48 taskfile flag from do_rw_taskfile()
        function to the callers.
      
      * Add IDE_TFLAG_FLAGGED taskfile flag for flagged taskfiles coming
        from ide_taskfile_ioctl().  Check it instead of ->tf_out_flags.all.
      
      * Add IDE_TFLAG_OUT_DATA taskfile flag to indicate the need to load
        IDE data register in ide_tf_load().
      
      * Add IDE_TFLAG_OUT_* taskfile flags to indicate the need to load
        particular IDE taskfile registers in ide_tf_load().
      
      * Update do_rw_taskfile() and ide_tf_load() users to set respective
        IDE_TFLAG_OUT_* taksfile flags.
      
      * Add task_dma_ok() helper.
      
      * Use IDE_TFLAG_FLAGGED taskfile flag to select HIHI mask in ide_tf_load().
      
      * Use do_rw_taskfile() in flagged_taskfile().
      
      * Remove no longer needed 'tf_out_flags' field from ide_task_t.
      
      There should be no functionality changes caused by this patch.
      
      Cc: Tejun Heo <htejun@gmail.com>
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      74095a91
    • B
      ide: add struct ide_taskfile (take 2) · 650d841d
      Bartlomiej Zolnierkiewicz 提交于
      * Don't set write-only ide_task_t.hobRegister[6] and ide_task_t.hobRegister[7]
        in idedisk_set_max_address_ext().
      
      * Add struct ide_taskfile and use it in ide_task_t instead of tfRegister[]
        and hobRegister[].
      
      * Remove no longer needed IDE_CONTROL_OFFSET_HOB define.
      
      * Add #ifndef/#endif __KERNEL__ around definitions of {task,hob}_struct_t.
      
      While at it:
      
      * Use ATA_LBA define for LBA bit (0x40) as suggested by Tejun Heo.
      
      v2:
      * Add missing newlines. (Noticed by Sergei)
      
      * Use ~ATA_LBA instead of 0xBF. (Noticed by Sergei)
      
      * Use unnamed unions for error/feature and status/command.
        (Suggested by Sergei).
      
      There should be no functionality changes caused by this patch.
      Acked-by: NSergei Shtylyov <sshtylyov@ru.mvista.com>
      Cc: Tejun Heo <htejun@gmail.com>
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      650d841d
    • A
      ide-io: set REQ_FAILED when drive is dead · b5e1a4e2
      Aristeu Rozanski 提交于
      Currently it's possible to ide-cd to set an incorrect blocksize by
      reading garbage if the drive is dead:
      
      ide_cd_probe()
       -> cdrom_read_toc()
           -> cdrom_read_capacity()
               -> cdrom_queue_packet_command()
                   -> ide_do_drive_cmd()
                       -> ide_do_request()
                           -> start_request()
      
      on start_request():
      
              /* bail early if we've exceeded max_failures */
              if (drive->max_failures && (drive->failures > drive->max_failures)) {
                      goto kill_rq;
              }
      (...)
      kill_rq:
              ide_kill_rq(drive, rq);
              return ide_stopped;
      
      ide_kill_rq() and the next calls won't set REQ_FAILED on rq->cmd_flags and thus
      cdrom_queue_packet_command() won't return an error. then:
      
              stat = cdrom_queue_packet_command(drive, &req);
              if (stat == 0) {
                      *capacity = 1 + be32_to_cpu(capbuf.lba);
                      *sectors_per_frame =
                              be32_to_cpu(capbuf.blocklen) >> SECTOR_BITS;
              }
      
      cdrom_read_capacity() ends believing capbuf is valid but in fact it's just
      uninitialized data. back to cdrom_read_toc():
      
              /* Try to get the total cdrom capacity and sector size. */
              stat = cdrom_read_capacity(drive, &toc->capacity, &sectors_per_frame,
                                         sense);
              if (stat)
                      toc->capacity = 0x1fffff;
      
              set_capacity(info->disk, toc->capacity * sectors_per_frame);
              /* Save a private copy of te TOC capacity for error handling */
              drive->probed_capacity = toc->capacity * sectors_per_frame;
      
              blk_queue_hardsect_size(drive->queue,
                                      sectors_per_frame << SECTOR_BITS);
      
      that will set drive->queue->hardsect_size to be the random value.
      hardsect_size is used to calculate inode->i_blkbits. later on, on a read
      path:
      
      void create_empty_buffers(struct page *page,
                              unsigned long blocksize, unsigned long b_state)
      {       
              struct buffer_head *bh, *head, *tail;
      
              head = alloc_page_buffers(page, blocksize, 1);
              bh = head;
              do {    
                      bh->b_state |= b_state;
                      tail = bh;
                      bh = bh->b_this_page;
              } while (bh);
              tail->b_this_page = head;
      
      alloc_page_buffers() will return NULL if blocksize > 4096. blocksize is
      calculed based on inode->i_blkbits. that will trigger a null
      dereference on create_empty_buffers().
      Signed-off-by: NAristeu Rozanski <arozansk@redhat.com>
      Cc: Borislav Petkov <bbpetkov@yahoo.de>
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      b5e1a4e2
  3. 13 12月, 2007 1 次提交
  4. 14 11月, 2007 1 次提交
  5. 06 11月, 2007 2 次提交
  6. 20 10月, 2007 3 次提交