History log of /haiku/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.h
Revision Date Author Comments
# ac0506fd 30-May-2023 Augustin Cavalier <waddlesplash@gmail.com>

usb_disk: Granularize locking.

There is now an "io_lock" which must be held when performing any USB
operations. All ioctls that read basic status, size, icon, etc. information
do not need to acquire it, of course, which should improve userland
lockup occurrences on congested USB disks.


# 20313e56 30-May-2023 Augustin Cavalier <waddlesplash@gmail.com>

usb_disk: Clean up and consolidate mutex/semaphore creation/destruction.


# 197e4b5a 29-May-2023 Augustin Cavalier <waddlesplash@gmail.com>

usb_disk: Use DMAResource for bouncing and support physical I/O requests.

A "bypass" mechanism is left in for when DMAResource would just add
overhead for no reason. All other I/O goes through it and is submitted
to the USB stack as physical addresses.

Tested in QEMU, can still boot from USB on all busses.

Fixes #15569.

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


# b256fa4a 25-May-2023 Augustin Cavalier <waddlesplash@gmail.com>

usb_disk: Transition to "new" driver API.

Change-Id: Ia46cb6ddc9f83917a8f797149508d35b770e44f1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6473
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


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


# d2e5fc7f 24-Jun-2022 Jérôme Duval <jerome.duval@gmail.com>

usb_disk: add support for drives bigger than 2TB

* tested read/write with a NTFS partition at the end of a 5TB USB hard disk.
* fix #14670

Change-Id: Ic005dfb7ef94b50a2d6fc8099ef5c83ec6b4a730
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5397
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 16a54a87 28-Nov-2018 Adrien Destugues <pulkomandy@pulkomandy.tk>

Merge usb_floppy back into usb_disk.

- USB pen drive seems to still work. More extensive testing welcome.
- USB floppies don't work yet, but they don't work anymore with the
current driver, either. I'm still investigating that part.

Fixes #9276

Change-Id: I8aa5ab828ad2ad867d0c187062d6e179372fc2ad
Reviewed-on: https://review.haiku-os.org/747
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# d9ecf5f3 31-Jul-2014 Jérôme Duval <jerome.duval@gmail.com>

usb_disk: extract specs into a public header.


# 9def48ad 28-Nov-2012 Michael Lotz <mmlr@mlotz.ch>

Implement B_GET_DEVICE_NAME in usb_disk returning SCSI info.

The SCSI inquiry vendor and product information is concatenated into a
single string to form the device name. Multiple spaces are then
collapsed to make the string more readable. The space padding is quite
common as the fields are fixed size in the inquiry block.


# 8f4f2bf9 11-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

Implement support for ATAPI command set devices. It's used by some USB CD drives
and easy to implement since ATAPI basically is SCSI anyway and we don't use many
problematic commands. Only tested for the 0x05 subclass, but 0x02 should work
the same.


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


# de9aa21e 26-Aug-2009 Michael Lotz <mmlr@mlotz.ch>

If the device tells us that it doesn't support the Test Unit Ready (TUR) command,
don't try to use it for media status polling. In those cases we'll assume a
fixed device with no exchangable medias and therefore always return B_OK.


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


# 40b708f7 17-Aug-2009 Michael Lotz <mmlr@mlotz.ch>

Do not base the device number on the device count. Fixes bug #4267.


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


# ac0a9729 09-Apr-2009 Michael Lotz <mmlr@mlotz.ch>

Adding mode sense command to retrieve the write protected status. Doesn't work
yet, so not enabled for now.


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


# f1a9c3c2 04-Apr-2008 Michael Lotz <mmlr@mlotz.ch>

Implement a downcounter for the synchronize cache command. There are devices
that do not support it (probably because they do not have a cache at all like
in flash media) and this should at least avoid spamming the syslog when this is
the case. It will try 5 times and then disable syncing for that device. Untested
as of yet though.

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


# a380bc25 04-Apr-2008 Michael Lotz <mmlr@mlotz.ch>

* Add support for devices with multiple LUNs
* A device now has one or more LUNs which are used for LUN specific functions
* Adapted these LUN specific functions to the new design and also change the
(un-)publishing accordingly
* Handle "no media" cases more correctly
* Output some interesting device infos also with tracing disabled
* Add some more helpful debug output here and there

Devices that provide multiple logical units (like those n in 1 card readers)
should now be usable with usb_disk too. Also we don't fail when a device is
attached which currently does not contain a media. Instead handle media changes
correctly so inserting a media works as expected. Note that hot-unplugging and
media removal still does not quite work right at the devfs or disk device
manager level and easily crashes the system.

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


# 01533b17 31-Mar-2008 Michael Lotz <mmlr@mlotz.ch>

Introduce a simple usb_disk driver that supports USB mass storage devices of
the bulk-only class using transparent SCSI commands (i.e. most of the current
external harddrives and flash media). It emulates the few SCSI commands needed
to get this sort of devices working and does not interface with the SCSI
subsystem. This makes it far easier to get working and also far better fits
how the USB stack works (as drivers can be dynamically rescanned when device
changes occur). This will allow for easy dynamic un- and replugging at runtime.
Note that while the device is currently published when you plug something in at
runtime, the partitions are not scanned and published automatically. It works
however if you have the device plugged in at boot.
I haven't added this driver to the image yet, but if properly installed and
with boot module links to the driver and USB stack, it allows to boot Haiku
from USB media like memory sticks or external harddrives.

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


# d9ecf5f373dab3ddaf7579c0b725705c7178d4b0 31-Jul-2014 Jérôme Duval <jerome.duval@gmail.com>

usb_disk: extract specs into a public header.


# 9def48ad2e7ef77665a09724536d4f456405b64c 28-Nov-2012 Michael Lotz <mmlr@mlotz.ch>

Implement B_GET_DEVICE_NAME in usb_disk returning SCSI info.

The SCSI inquiry vendor and product information is concatenated into a
single string to form the device name. Multiple spaces are then
collapsed to make the string more readable. The space padding is quite
common as the fields are fixed size in the inquiry block.


# 8f4f2bf933413442fc8b541f26fb53a908ecbc4a 11-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

Implement support for ATAPI command set devices. It's used by some USB CD drives
and easy to implement since ATAPI basically is SCSI anyway and we don't use many
problematic commands. Only tested for the 0x05 subclass, but 0x02 should work
the same.


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


# de9aa21e08bdec378dd06f5b49477edcf347e6cb 26-Aug-2009 Michael Lotz <mmlr@mlotz.ch>

If the device tells us that it doesn't support the Test Unit Ready (TUR) command,
don't try to use it for media status polling. In those cases we'll assume a
fixed device with no exchangable medias and therefore always return B_OK.


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


# 40b708f776042f64213f40af1586234ae17e9b31 17-Aug-2009 Michael Lotz <mmlr@mlotz.ch>

Do not base the device number on the device count. Fixes bug #4267.


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


# ac0a97298599d31d45e83b47234b453328d3613f 09-Apr-2009 Michael Lotz <mmlr@mlotz.ch>

Adding mode sense command to retrieve the write protected status. Doesn't work
yet, so not enabled for now.


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


# f1a9c3c21468099abed6e55837d8bf0559f3e789 04-Apr-2008 Michael Lotz <mmlr@mlotz.ch>

Implement a downcounter for the synchronize cache command. There are devices
that do not support it (probably because they do not have a cache at all like
in flash media) and this should at least avoid spamming the syslog when this is
the case. It will try 5 times and then disable syncing for that device. Untested
as of yet though.

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


# a380bc25131132eaafceca992acc027690fbaf55 04-Apr-2008 Michael Lotz <mmlr@mlotz.ch>

* Add support for devices with multiple LUNs
* A device now has one or more LUNs which are used for LUN specific functions
* Adapted these LUN specific functions to the new design and also change the
(un-)publishing accordingly
* Handle "no media" cases more correctly
* Output some interesting device infos also with tracing disabled
* Add some more helpful debug output here and there

Devices that provide multiple logical units (like those n in 1 card readers)
should now be usable with usb_disk too. Also we don't fail when a device is
attached which currently does not contain a media. Instead handle media changes
correctly so inserting a media works as expected. Note that hot-unplugging and
media removal still does not quite work right at the devfs or disk device
manager level and easily crashes the system.

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


# 01533b17a2fb17655269a98888e9af6622708127 31-Mar-2008 Michael Lotz <mmlr@mlotz.ch>

Introduce a simple usb_disk driver that supports USB mass storage devices of
the bulk-only class using transparent SCSI commands (i.e. most of the current
external harddrives and flash media). It emulates the few SCSI commands needed
to get this sort of devices working and does not interface with the SCSI
subsystem. This makes it far easier to get working and also far better fits
how the USB stack works (as drivers can be dynamically rescanned when device
changes occur). This will allow for easy dynamic un- and replugging at runtime.
Note that while the device is currently published when you plug something in at
runtime, the partitions are not scanned and published automatically. It works
however if you have the device plugged in at boot.
I haven't added this driver to the image yet, but if properly installed and
with boot module links to the driver and USB stack, it allows to boot Haiku
from USB media like memory sticks or external harddrives.

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