History log of /haiku/src/add-ons/kernel/generic/scsi_periph/io.cpp
Revision Date Author Comments
# 8b1d35bd 03-Jul-2021 David Sebek <dasebek@gmail.com>

Improve SCSI and SATA trim support

Fixes:
* scsi: Fix a bug that caused the device capacity to be set
to an undefined value for some large SCSI devices when
READ CAPACITY (16) was used
* ahci: Fix VPD page reporting so that it does not return
undefined values
* ahci: Set the write bit to true when sending a DATA SET
MANAGEMENT (trim) command to a device. The command would
otherwise fail and time out on some devices.

Improvements:
* scsi: Extend the READ CAPACITY (16) support to also
include logical block provisioning information
* scsi: Prefer READ CAPACITY (16) over READ CAPACITY (10)
on devices that are expected to support this command
* scsi, ahci: Enable trim on SCSI and SATA devices that
are expected to support trim and which correctly report
trim support
* ahci: Redo the implementation of the SCSI UNMAP command
* scsi: Redo UNMAP-related code
* scsi: Add support for UNMAP via WRITE SAME (10) and
WRITE SAME (16) commands
* When copying trim ranges between different data types,
make sure that the values don't change (detect overflows)
* Report the number of trimmed blocks even if the trim
operation fails

Change-Id: Ie5fc993bbbc19546b4308138ba10184bf7b9986a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4157
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# ff4af513 25-May-2019 Jérôme Duval <jerome.duval@gmail.com>

scsi_periph: use bounce buffers for userland raw commands.

also errors when the buffer length is too small for the request buffer type.

basically tested, this is difficult to test without physical hardware.
this fixes #14966

Change-Id: Iebee5ff29dfe498ee52cab5867c8c4ff7d2bcde1
Reviewed-on: https://review.haiku-os.org/c/1484
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# b5ace95f 24-Feb-2018 Jérôme Duval <jerome.duval@gmail.com>

scsi_periph: use user_memcpy for user buffers.

ioctls in this module can actually be called from the kernel (file systems or
ddm).


# f13c2249 11-Apr-2014 Jérôme Duval <jerome.duval@gmail.com>

scsi_periph: fixed an "unused" warning.


# 6fd00f80 09-Apr-2014 Jérôme Duval <jerome.duval@gmail.com>

scsi_periph: implemented VPD inquiry.

* declared block limits and logical block provisioning structs.
* based on SPC-4 and SBC-4 standards.


# bfdb2a49 27-Jan-2014 Jérôme Duval <jerome.duval@gmail.com>

scsi_periph: check block_size against zero in io().

* should help with #10466


# e523d3cf 02-Mar-2011 Jérôme Duval <korli@users.berlios.de>

changed ioctl hook return code when the opcode isn't supported.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40786 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 51d76425 13-Jan-2011 Axel Dörfler <axeld@pinc-software.de>

* Added a new B_GET_DEVICE_NAME ioctl - this should be implemented by all
drivers in the future, such that NetworkStatus and similar software can show
nice names for the devices. The device manager should implement this and
return the B_DEVICE_PRETTY_NAME of the device (and in turn, new style drivers
should actually set this).
* Implemented handling of this ioctl in the scsi_periph to return the vendor/
product strings.
* Implemented this in the ATA bus manager to return the model from the info
block.
* KDiskDevice now fills in the partition_data::name if the B_GET_DEVICE_NAME
succeeds.
* As a side effect, at least BootManager now shows the drive name; maybe
DriveSetup does as well for the raw device.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40231 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6fa1b3a5 04-Nov-2010 Jérôme Duval <korli@users.berlios.de>

actually use the 64bits value when doing comparing, previously SCSI_6 were wronly used for some io requests.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39301 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f0588869 02-Nov-2010 Jérôme Duval <korli@users.berlios.de>

* added definitions for SCSI_OP_VERIFY_* op commands
* added support READ_12/16 and WRITE_12/16 in ata and scsi_periph, this enables read/write on block offsets greater than 2TB


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39278 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 02507604 21-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

read_write(): Consider a request created from an io_operation DMA safe. This
saves some checking in the bus manager.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37199 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 455b379c 01-Jun-2010 Axel Dörfler <axeld@pinc-software.de>

* Added a read_write() function to the scsi_periph module.
* Internally, moved the contents of periph_io() into a static read_write()
function, and use it from the new periph_read_write() as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36988 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 266ee1f2 01-Jun-2010 Axel Dörfler <axeld@pinc-software.de>

* Added a TODO about reporting partial transfers.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36985 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c443d19c 11-Oct-2009 Michael Lotz <mmlr@mlotz.ch>

Tiny style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33522 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 547b151f 30-Aug-2009 Marcus Overhagen <marcusoverhagen@gmail.com>

Fix data direction flag (using 0 was invalid) for prevent_allow command.
This fixes ticket #4379, panic on eject.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32833 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2c0a05cc 12-Sep-2008 Michael Lotz <mmlr@mlotz.ch>

CID 1258: This was probably missed when replacing all "write" with
operation->IsWrite().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27466 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 24593e2c 05-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* First baby steps in letting our drivers use the new I/O request/scheduler
architecture: for now, we do this on the lowest layer only, therefore all
requests are handled synchronously (ie. in the scheduler's thread).
* Instead of using the block_io module, scsi_disk (and scsi_cd) are now
exporting a device on their own, and use an I/O scheduler with an appropriate
DMA resource.
* There are still lots of TODOs, and it can easily panic - don't update if
you intend to demo Haiku.
* scsi_periph now only has an io() function that get an io_operation, instead
of the previous read/write functions, moved preferred CCB size from those
functions into the device registration.
* Changed all scsi_periph files to C++.
* scsi_cd ported, too, but untested.
* Removed block_io from image - it will be removed completely soon.
* Temporarily commented an ASSERT() in the ATA bus manager (in case you use
it); it's sometimes triggered by the code now, and I haven't yet looked into
the issue -- doesn't seem to harm, at least.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26828 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f13c2249b26484b0b4e4c21e4fc0cdf7234e1576 11-Apr-2014 Jérôme Duval <jerome.duval@gmail.com>

scsi_periph: fixed an "unused" warning.


# 6fd00f80e8ebb9c1d4fa17caa9db128bad9a7f1c 09-Apr-2014 Jérôme Duval <jerome.duval@gmail.com>

scsi_periph: implemented VPD inquiry.

* declared block limits and logical block provisioning structs.
* based on SPC-4 and SBC-4 standards.


# bfdb2a493884ca720e31bbdd42bae23764bce75c 27-Jan-2014 Jérôme Duval <jerome.duval@gmail.com>

scsi_periph: check block_size against zero in io().

* should help with #10466


# e523d3cfc19042fd61bc09cb10935947dfd16c71 02-Mar-2011 Jérôme Duval <korli@users.berlios.de>

changed ioctl hook return code when the opcode isn't supported.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40786 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 51d76425033b27609fb4e206c7c9610cd4c4a653 13-Jan-2011 Axel Dörfler <axeld@pinc-software.de>

* Added a new B_GET_DEVICE_NAME ioctl - this should be implemented by all
drivers in the future, such that NetworkStatus and similar software can show
nice names for the devices. The device manager should implement this and
return the B_DEVICE_PRETTY_NAME of the device (and in turn, new style drivers
should actually set this).
* Implemented handling of this ioctl in the scsi_periph to return the vendor/
product strings.
* Implemented this in the ATA bus manager to return the model from the info
block.
* KDiskDevice now fills in the partition_data::name if the B_GET_DEVICE_NAME
succeeds.
* As a side effect, at least BootManager now shows the drive name; maybe
DriveSetup does as well for the raw device.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40231 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6fa1b3a596a317b521d620c3093ed91e44926adc 04-Nov-2010 Jérôme Duval <korli@users.berlios.de>

actually use the 64bits value when doing comparing, previously SCSI_6 were wronly used for some io requests.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39301 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f058886908e994cc5a6c141e212c3bd62e923023 02-Nov-2010 Jérôme Duval <korli@users.berlios.de>

* added definitions for SCSI_OP_VERIFY_* op commands
* added support READ_12/16 and WRITE_12/16 in ata and scsi_periph, this enables read/write on block offsets greater than 2TB


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39278 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 02507604e7979d8d3c4e48572799374a47eb71ac 21-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

read_write(): Consider a request created from an io_operation DMA safe. This
saves some checking in the bus manager.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37199 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 455b379c2799703a11b8d17521840808f11afe6c 01-Jun-2010 Axel Dörfler <axeld@pinc-software.de>

* Added a read_write() function to the scsi_periph module.
* Internally, moved the contents of periph_io() into a static read_write()
function, and use it from the new periph_read_write() as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36988 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 266ee1f290045e52252cd7ed4c38afdcf198fbab 01-Jun-2010 Axel Dörfler <axeld@pinc-software.de>

* Added a TODO about reporting partial transfers.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36985 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c443d19cd2ad9bc518fc01a053391e2c617c1246 11-Oct-2009 Michael Lotz <mmlr@mlotz.ch>

Tiny style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33522 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 547b151fa291f7df09031cad1f8b35cc8b86e6f8 30-Aug-2009 Marcus Overhagen <marcusoverhagen@gmail.com>

Fix data direction flag (using 0 was invalid) for prevent_allow command.
This fixes ticket #4379, panic on eject.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32833 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2c0a05cce129120e45a6c5b5e4618fc2bbf40e89 12-Sep-2008 Michael Lotz <mmlr@mlotz.ch>

CID 1258: This was probably missed when replacing all "write" with
operation->IsWrite().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27466 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 24593e2c79f5f228fd9e1edd3e705d5aa286dcdb 05-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* First baby steps in letting our drivers use the new I/O request/scheduler
architecture: for now, we do this on the lowest layer only, therefore all
requests are handled synchronously (ie. in the scheduler's thread).
* Instead of using the block_io module, scsi_disk (and scsi_cd) are now
exporting a device on their own, and use an I/O scheduler with an appropriate
DMA resource.
* There are still lots of TODOs, and it can easily panic - don't update if
you intend to demo Haiku.
* scsi_periph now only has an io() function that get an io_operation, instead
of the previous read/write functions, moved preferred CCB size from those
functions into the device registration.
* Changed all scsi_periph files to C++.
* scsi_cd ported, too, but untested.
* Removed block_io from image - it will be removed completely soon.
* Temporarily commented an ASSERT() in the ATA bus manager (in case you use
it); it's sometimes triggered by the code now, and I haven't yet looked into
the issue -- doesn't seem to harm, at least.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26828 a95241bf-73f2-0310-859d-f6bbb57e9c96