History log of /haiku/src/add-ons/kernel/generic/scsi_periph/scsi_periph_int.h
Revision Date Author Comments
# 688acf41 15-Sep-2022 Jérôme Duval <jerome.duval@gmail.com>

add physical_block_size field where applicable

only scsi_disk checks the actual value, other drivers take the logical block size.

This change reports the physical block size from the disk rather than the block
size used by IDE/SATA/SCSI commands. On typical modern SATA disks, the SATA
commands will use 512 byte blocks, but the disk will actually read and write
4K blocks internally. This is only of importance for partition alignment for DriveSetup,
and is independant of file systems or partitioning systems. This could also influence
the recommended block size for some file systems.

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


# 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>


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

scsi_periph: fixed an "unused" warning.


# 99086aa3 14-Aug-2013 Axel Dörfler <axeld@pinc-software.de>

trim: Target SCSI UNMAP command instead of WRITE SAME.

* The UNMAP command is theoretically much faster, as it can get many block
ranges instead of just a single range.
* Furthermore, the ATA TRIM command resembles it much better.
* Therefore, fs_trim_data now gets an array of ranges, and we use SCSI UNMAP
to trim.
* Updated BFS code to collect array ranges to fully support the new
fs_trim_data possibilities.


# 960c56ae 04-Aug-2013 Axel Dörfler <axeld@pinc-software.de>

This gets the trim command as WRITE SAME operation to SCSI

* Neither hardware nor driver to test it; AHCI/IDE support is next
on the table.


# 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


# aa4ba93e 08-Mar-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed src/system/kernel/device_manager/io_requests.{h,cpp} to
IORequest.{h,cpp}.
* Introduced public <io_requests.h> header. Currently it only declares the
single function BFS uses.


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


# 8e390e5e 18-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Removed icon support from scsi_periph.
* Removed B_GET_ICON support from scsi_disk, and scsi_cd. This won't be
necessary anymore soon.


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


# 70e2d4ac 14-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Replaced the B_BLOCK_DEVICE_* defines with B_DMA_* defines that better match
our dma_restrictions structure (but we're using blocks instead of bytes,
since unlike the block size, the restrictions attributes are constant).
* We might want to use blocks for the dma_restrictions structure as well in
the future...
* Fixed another bug in the device_node variant of DMAResource::Init(): the max
segment size was specified in blocks as well.
* Removed the "hardcode" block_io module and header.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26973 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


# 2b07b8e0 28-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Replaced all instances of benaphores in the kernel code by mutexes.
* Removed kernel benaphores.


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


# 368167ed 26-May-2008 Axel Dörfler <axeld@pinc-software.de>

* Integration of the new driver architecture.
* Moved devfs from fs/ to device_manager/, and separated the legacy driver
support from it.
* Removed fast_log module.
* There are a couple of (temporary) regressions, though:
- legacy SATA and ISA IDE support is disabled, the drivers haven't been
ported yet.
- The not yet used ATA bus manager hasn't been ported yet, either.
- AHCI changes have not been tested.
- the listdev command has been removed from the build (as it currently
doesn't work anymore).
- device manager generated IDs currently are not freed anymore when a device
node is removed.
- generic drivers can't yet use the new driver architecture.
- simple busses that do not support device types won't work yet.
- legacy driver publishing/unpublishing (ie. what USB needs) has not been
tested, and may be broken.


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


# 8ce98e44 28-Sep-2007 Marcus Overhagen <marcusoverhagen@gmail.com>

convert files to new include file locations


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


# e62e6bd5 16-Jan-2007 Bruno G. Albuquerque <bga@bug-br.org.br>

Implemented support for hardware cache flush. This is based on code I originally
did for yellowTAB GmbH when I worked for then and is being used under permission.



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


# 879d9c6b 12-May-2005 Axel Dörfler <axeld@pinc-software.de>

Renamed the "blkman" module to "block_io".
Also renamed some defines and structures, although the structure and some other names are still odd.
This module should probably be moved into the kernel anyway, as it provides basic and crucial services.


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


# 9c4f4c03 11-Jan-2005 Axel Dörfler <axeld@pinc-software.de>

Changes because of renaming various data structures (pnp_node -> device_node, ...).
Minor cleanup.


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


# b59852c8 06-Jun-2004 Axel Dörfler <axeld@pinc-software.de>

Added Thomas Kurschel's scsi_periph module.


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


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

scsi_periph: fixed an "unused" warning.


# 99086aa32333be5792b0f059ccbbe3c90be05ea6 14-Aug-2013 Axel Dörfler <axeld@pinc-software.de>

trim: Target SCSI UNMAP command instead of WRITE SAME.

* The UNMAP command is theoretically much faster, as it can get many block
ranges instead of just a single range.
* Furthermore, the ATA TRIM command resembles it much better.
* Therefore, fs_trim_data now gets an array of ranges, and we use SCSI UNMAP
to trim.
* Updated BFS code to collect array ranges to fully support the new
fs_trim_data possibilities.


# 960c56aea53d8a930ab5dbbd3265e2b14e04e0ae 04-Aug-2013 Axel Dörfler <axeld@pinc-software.de>

This gets the trim command as WRITE SAME operation to SCSI

* Neither hardware nor driver to test it; AHCI/IDE support is next
on the table.


# 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


# aa4ba93e25c1c63730ba69e04d3d96c3253924fd 08-Mar-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed src/system/kernel/device_manager/io_requests.{h,cpp} to
IORequest.{h,cpp}.
* Introduced public <io_requests.h> header. Currently it only declares the
single function BFS uses.


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


# 8e390e5ea7f4881402c86ea385521b4f67dd2264 18-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Removed icon support from scsi_periph.
* Removed B_GET_ICON support from scsi_disk, and scsi_cd. This won't be
necessary anymore soon.


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


# 70e2d4ac43aa54d8c567ec12e6b24155d3171dd9 14-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Replaced the B_BLOCK_DEVICE_* defines with B_DMA_* defines that better match
our dma_restrictions structure (but we're using blocks instead of bytes,
since unlike the block size, the restrictions attributes are constant).
* We might want to use blocks for the dma_restrictions structure as well in
the future...
* Fixed another bug in the device_node variant of DMAResource::Init(): the max
segment size was specified in blocks as well.
* Removed the "hardcode" block_io module and header.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26973 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


# 2b07b8e0f1a7f1e76f31db24a21a42cbb01d7b9c 28-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Replaced all instances of benaphores in the kernel code by mutexes.
* Removed kernel benaphores.


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


# 368167ede8118f72da8c9ac5bb98ce9b46a8a639 26-May-2008 Axel Dörfler <axeld@pinc-software.de>

* Integration of the new driver architecture.
* Moved devfs from fs/ to device_manager/, and separated the legacy driver
support from it.
* Removed fast_log module.
* There are a couple of (temporary) regressions, though:
- legacy SATA and ISA IDE support is disabled, the drivers haven't been
ported yet.
- The not yet used ATA bus manager hasn't been ported yet, either.
- AHCI changes have not been tested.
- the listdev command has been removed from the build (as it currently
doesn't work anymore).
- device manager generated IDs currently are not freed anymore when a device
node is removed.
- generic drivers can't yet use the new driver architecture.
- simple busses that do not support device types won't work yet.
- legacy driver publishing/unpublishing (ie. what USB needs) has not been
tested, and may be broken.


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


# 8ce98e44ccce2220ad96b65043d7df792229f552 28-Sep-2007 Marcus Overhagen <marcusoverhagen@gmail.com>

convert files to new include file locations


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


# e62e6bd5a7b9cddcfcd72bdccf9653bb8b376cc1 16-Jan-2007 Bruno G. Albuquerque <bga@bug-br.org.br>

Implemented support for hardware cache flush. This is based on code I originally
did for yellowTAB GmbH when I worked for then and is being used under permission.



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


# 879d9c6b6e1326c1432ad9f1196c3cde682f660d 12-May-2005 Axel Dörfler <axeld@pinc-software.de>

Renamed the "blkman" module to "block_io".
Also renamed some defines and structures, although the structure and some other names are still odd.
This module should probably be moved into the kernel anyway, as it provides basic and crucial services.


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


# 9c4f4c037d1026f630885f682de9d5a4c24cc124 11-Jan-2005 Axel Dörfler <axeld@pinc-software.de>

Changes because of renaming various data structures (pnp_node -> device_node, ...).
Minor cleanup.


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


# b59852c818bcebbb67640cc4166d586f90d3c1d8 06-Jun-2004 Axel Dörfler <axeld@pinc-software.de>

Added Thomas Kurschel's scsi_periph module.


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