qemu-e2k/hw/ide
Lev Kujawski 176e4961bb hw/ide/core.c: Implement ATA INITIALIZE_DEVICE_PARAMETERS command
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: Lev Kujawski <lkujaw@member.fsf.org>
Message-Id: <20220707031140.158958-7-lkujaw@member.fsf.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2022-09-30 18:43:44 +02:00
..
ahci_internal.h hw: Do not include hw/sysbus.h if it is not necessary 2021-05-02 17:24:50 +02:00
ahci-allwinner.c ahci: Move QOM macro to header 2020-08-27 14:04:54 -04:00
ahci.c hw/dma: Let dma_buf_read() / dma_buf_write() propagate MemTxResult 2022-01-18 12:56:29 +01:00
atapi.c block: Change blk_{pread,pwrite}() param order 2022-07-12 12:14:56 +02:00
cmd646.c ide: Rename ide_bus_new() to ide_bus_init() 2021-09-30 13:44:13 +01:00
core.c hw/ide/core.c: Implement ATA INITIALIZE_DEVICE_PARAMETERS command 2022-09-30 18:43:44 +02:00
ich.c nomaintainer: Fix Lesser GPL version number 2020-11-15 17:04:40 +01:00
ioport.c hw/ide: Fix crash when plugging a piix3-ide device into the x-remote machine 2021-07-19 10:08:45 +02:00
isa.c hw/isa: Inline and remove one-line isa_init_irq() 2022-03-08 19:38:17 +01:00
Kconfig hw/ide/Kconfig: Add missing dependency PCI -> IDE_QDEV 2021-07-20 15:30:42 +02:00
macio.c ide_ioport_read: Return lower octet of data register instead of 0xFF 2022-05-25 21:26:35 +02:00
meson.build meson: convert hw/ide 2020-08-21 06:30:30 -04:00
microdrive.c ide: Rename ide_bus_new() to ide_bus_init() 2021-09-30 13:44:13 +01:00
mmio.c ide: Rename ide_bus_new() to ide_bus_init() 2021-09-30 13:44:13 +01:00
pci.c ide: rename cmd_write to ctrl_write 2020-10-01 13:04:16 -04:00
piix.c piix_ide_reset: Use pci_set_* functions instead of direct access 2022-09-30 18:43:44 +02:00
qdev.c ide: Rename ide_bus_new() to ide_bus_init() 2021-09-30 13:44:13 +01:00
sii3112.c ide: Rename ide_bus_new() to ide_bus_init() 2021-09-30 13:44:13 +01:00
trace-events docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
via.c via-ide: Avoid using isa_get_irq() 2021-10-18 00:41:36 +02:00