Skip to content
  • Lev Kujawski's avatar
    176e4961
    hw/ide/core.c: Implement ATA INITIALIZE_DEVICE_PARAMETERS command · 176e4961
    Lev Kujawski authored
    
    
    CHS-based disk utilities and operating systems may adjust the logical
    geometry of a hard drive to cope with the expectations or limitations
    of software using the ATA INITIALIZE_DEVICE_PARAMETERS command.
    
    Prior to this patch, INITIALIZE_DEVICE_PARAMETERS was a nop that
    always returned success, raising the possibility of data loss or
    corruption if the CHS<->LBA translation redirected a write to the
    wrong sector.
    
    * hw/ide/core.c
    ide_reset():
      Reset the logical CHS geometry of the hard disk when the power-on
      defaults feature is enabled.
    cmd_specify():
      a) New function implementing INITIALIZE_DEVICE_PARAMETERS.
      b) Ignore calls for empty or ATAPI devices.
    cmd_set_features():
      Implement the power-on defaults enable and disable features.
    struct ide_cmd_table:
      Switch WIN_SPECIFY from cmd_nop() to cmd_specify().
    ide_init_drive():
      Set new fields 'drive_heads' and 'drive_sectors' based upon the
      actual disk geometry.
    
    * include/hw/ide/internal.h
    struct IDEState:
    a) Store the actual drive CHS values within the new fields
       'drive_heads' and 'drive_sectors.'
    b) Track whether a soft IDE reset should also reset the logical CHS
       geometry of the hard disk within the new field 'reset_reverts'.
    
    Signed-off-by: default avatarLev Kujawski <lkujaw@member.fsf.org>
    Message-Id: <20220707031140.158958-7-lkujaw@member.fsf.org>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    176e4961
    hw/ide/core.c: Implement ATA INITIALIZE_DEVICE_PARAMETERS command
    Lev Kujawski authored
    
    
    CHS-based disk utilities and operating systems may adjust the logical
    geometry of a hard drive to cope with the expectations or limitations
    of software using the ATA INITIALIZE_DEVICE_PARAMETERS command.
    
    Prior to this patch, INITIALIZE_DEVICE_PARAMETERS was a nop that
    always returned success, raising the possibility of data loss or
    corruption if the CHS<->LBA translation redirected a write to the
    wrong sector.
    
    * hw/ide/core.c
    ide_reset():
      Reset the logical CHS geometry of the hard disk when the power-on
      defaults feature is enabled.
    cmd_specify():
      a) New function implementing INITIALIZE_DEVICE_PARAMETERS.
      b) Ignore calls for empty or ATAPI devices.
    cmd_set_features():
      Implement the power-on defaults enable and disable features.
    struct ide_cmd_table:
      Switch WIN_SPECIFY from cmd_nop() to cmd_specify().
    ide_init_drive():
      Set new fields 'drive_heads' and 'drive_sectors' based upon the
      actual disk geometry.
    
    * include/hw/ide/internal.h
    struct IDEState:
    a) Store the actual drive CHS values within the new fields
       'drive_heads' and 'drive_sectors.'
    b) Track whether a soft IDE reset should also reset the logical CHS
       geometry of the hard disk within the new field 'reset_reverts'.
    
    Signed-off-by: default avatarLev Kujawski <lkujaw@member.fsf.org>
    Message-Id: <20220707031140.158958-7-lkujaw@member.fsf.org>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Loading