2004-06-07 03:52:08 +04:00
|
|
|
/*
|
2013-08-05 02:51:37 +04:00
|
|
|
* Copyright 2004-2013, Haiku, Inc. All RightsReserved.
|
2005-05-12 19:43:02 +04:00
|
|
|
* Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
2007-05-10 18:13:37 +04:00
|
|
|
*
|
2005-05-12 19:43:02 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2007-05-10 18:13:37 +04:00
|
|
|
#ifndef _SCSI_PERIPH_H
|
|
|
|
#define _SCSI_PERIPH_H
|
2004-06-07 03:52:08 +04:00
|
|
|
|
2013-08-05 02:51:37 +04:00
|
|
|
|
* 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
2008-08-06 01:11:51 +04:00
|
|
|
/*! Use this module to minimize work required to write a SCSI
|
2004-06-07 03:52:08 +04:00
|
|
|
peripheral driver.
|
2008-05-26 20:52:27 +04:00
|
|
|
|
2004-06-07 03:52:08 +04:00
|
|
|
It takes care of:
|
|
|
|
- error handling
|
|
|
|
- medium changes (including restarting the medium)
|
2008-05-26 20:52:27 +04:00
|
|
|
- detection of medium capacity
|
2004-06-07 03:52:08 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <bus/SCSI.h>
|
2007-09-28 18:53:42 +04:00
|
|
|
#include <scsi_cmds.h>
|
2004-06-07 03:52:08 +04:00
|
|
|
#include <Drivers.h>
|
|
|
|
|
|
|
|
// cookie issued by module per device
|
|
|
|
typedef struct scsi_periph_device_info *scsi_periph_device;
|
|
|
|
// cookie issued by module per file handle
|
|
|
|
typedef struct scsi_periph_handle_info *scsi_periph_handle;
|
|
|
|
|
|
|
|
// "standardized" error code to simplify handling of scsi errors
|
|
|
|
typedef enum {
|
|
|
|
err_act_ok, // executed successfully
|
|
|
|
err_act_retry, // failed, retry 3 times
|
|
|
|
err_act_fail, // failed, don't retry
|
|
|
|
err_act_many_retries, // failed, retry multiple times (currently 10 times)
|
|
|
|
err_act_start, // devices requires a "start" command
|
|
|
|
err_act_invalid_req // request is invalid
|
|
|
|
} err_act;
|
|
|
|
|
|
|
|
// packed scsi command result
|
|
|
|
typedef struct err_res {
|
|
|
|
status_t error_code : 32; // Be error code
|
|
|
|
uint32 action : 8; // err_act code
|
|
|
|
} err_res;
|
|
|
|
|
|
|
|
#define MK_ERROR( aaction, code ) ({ \
|
2018-06-19 05:05:45 +03:00
|
|
|
err_res _res = {error_code: (code), action: (aaction) }; \
|
|
|
|
_res; \
|
2004-06-07 03:52:08 +04:00
|
|
|
})
|
|
|
|
|
|
|
|
// cookie issued by driver to identify itself
|
|
|
|
//typedef struct periph_info *periph_cookie;
|
|
|
|
// cookie issued by driver per device
|
|
|
|
typedef struct periph_device_info *periph_device_cookie;
|
|
|
|
// cookie issued by driver per file handle
|
|
|
|
typedef struct periph_handle_info *periph_handle_cookie;
|
|
|
|
|
* 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
2008-08-06 01:11:51 +04:00
|
|
|
typedef struct IOOperation io_operation;
|
2004-06-07 03:52:08 +04:00
|
|
|
|
|
|
|
// callbacks to be provided by peripheral driver
|
|
|
|
typedef struct scsi_periph_callbacks {
|
|
|
|
// *** block devices ***
|
|
|
|
// informs of new size of medium
|
|
|
|
// (set to NULL if not a block device)
|
* 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
2008-08-06 01:11:51 +04:00
|
|
|
void (*set_capacity)(periph_device_cookie cookie, uint64 capacity,
|
|
|
|
uint32 blockSize);
|
2008-05-26 20:52:27 +04:00
|
|
|
|
2004-06-07 03:52:08 +04:00
|
|
|
// *** removable devices
|
|
|
|
// called when media got changed (can be NULL if medium is not changable)
|
|
|
|
// (you don't need to call periph->media_changed, but it's doesn't if you do)
|
|
|
|
// ccb - request at your disposal
|
* 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
2008-08-06 01:11:51 +04:00
|
|
|
void (*media_changed)(periph_device_cookie cookie, scsi_ccb *request);
|
2004-06-07 03:52:08 +04:00
|
|
|
} scsi_periph_callbacks;
|
|
|
|
|
2013-08-15 03:34:59 +04:00
|
|
|
typedef struct scsi_block_range {
|
2021-07-03 17:32:00 +03:00
|
|
|
// values are in blocks
|
|
|
|
uint64 lba;
|
2013-08-15 03:34:59 +04:00
|
|
|
uint64 size;
|
|
|
|
} scsi_block_range;
|
2004-06-07 03:52:08 +04:00
|
|
|
|
|
|
|
// functions provided by this module
|
|
|
|
typedef struct scsi_periph_interface {
|
2005-01-12 02:19:41 +03:00
|
|
|
module_info info;
|
2004-06-07 03:52:08 +04:00
|
|
|
|
|
|
|
// *** init/cleanup ***
|
* 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
2008-08-06 01:11:51 +04:00
|
|
|
// preferred_ccb_size - preferred command size; if zero, the shortest is used
|
|
|
|
status_t (*register_device)(periph_device_cookie cookie,
|
|
|
|
scsi_periph_callbacks *callbacks, scsi_device scsiDevice,
|
|
|
|
scsi_device_interface *scsi, device_node *node, bool removable,
|
|
|
|
int preferredCcbSize, scsi_periph_device *driver);
|
|
|
|
status_t (*unregister_device)(scsi_periph_device driver);
|
2008-05-26 20:52:27 +04:00
|
|
|
|
2004-06-07 03:52:08 +04:00
|
|
|
// *** basic command execution ***
|
|
|
|
// exec command, retrying on problems
|
* 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
2008-08-06 01:11:51 +04:00
|
|
|
status_t (*safe_exec)(scsi_periph_device periphCookie, scsi_ccb *request);
|
2004-06-07 03:52:08 +04:00
|
|
|
// exec simple command
|
* 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
2008-08-06 01:11:51 +04:00
|
|
|
status_t (*simple_exec)(scsi_periph_device device, void *cdb,
|
|
|
|
uint8 cdbLength, void *data, size_t dataLength, int ccbFlags);
|
2004-06-07 03:52:08 +04:00
|
|
|
|
2008-05-26 20:52:27 +04:00
|
|
|
// *** file handling ***
|
2004-06-07 03:52:08 +04:00
|
|
|
// to be called when a new file is opened
|
* 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
2008-08-06 01:11:51 +04:00
|
|
|
status_t (*handle_open)(scsi_periph_device device,
|
|
|
|
periph_handle_cookie periph_handle, scsi_periph_handle *_handle);
|
2004-06-07 03:52:08 +04:00
|
|
|
// to be called when a file is closed
|
* 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
2008-08-06 01:11:51 +04:00
|
|
|
status_t (*handle_close)(scsi_periph_handle handle);
|
2004-06-07 03:52:08 +04:00
|
|
|
// to be called when a file is freed
|
* 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
2008-08-06 01:11:51 +04:00
|
|
|
status_t (*handle_free)(scsi_periph_handle handle);
|
2008-05-26 20:52:27 +04:00
|
|
|
|
|
|
|
// *** default implementation for block devices ***
|
2010-06-01 17:37:55 +04:00
|
|
|
status_t (*read_write)(scsi_periph_device_info *device, scsi_ccb *request,
|
|
|
|
uint64 offset, size_t numBlocks, physical_entry* vecs, size_t vecCount,
|
|
|
|
bool isWrite, size_t* _bytesTransferred);
|
* 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
2008-08-06 01:11:51 +04:00
|
|
|
status_t (*io)(scsi_periph_device device, io_operation *operation,
|
|
|
|
size_t *_bytesTransferred);
|
|
|
|
|
2004-06-07 03:52:08 +04:00
|
|
|
// block ioctls
|
* 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
2008-08-06 01:11:51 +04:00
|
|
|
status_t (*ioctl)(scsi_periph_handle handle, int op, void *buffer,
|
|
|
|
size_t length);
|
2004-06-07 03:52:08 +04:00
|
|
|
// check medium capacity (calls set_capacity callback on success)
|
|
|
|
// request - ccb for this device; is used to talk to device
|
* 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
2008-08-06 01:11:51 +04:00
|
|
|
status_t (*check_capacity)(scsi_periph_device device, scsi_ccb *request);
|
2004-06-07 03:52:08 +04:00
|
|
|
|
2013-08-05 02:51:37 +04:00
|
|
|
// synchronizes (flush) the device cache
|
|
|
|
err_res (*synchronize_cache)(scsi_periph_device device, scsi_ccb *request);
|
|
|
|
|
|
|
|
status_t (*trim_device)(scsi_periph_device_info *device, scsi_ccb *request,
|
2021-07-03 17:32:00 +03:00
|
|
|
scsi_block_range* ranges, uint32 rangeCount, uint64* trimmedBlocks);
|
2013-08-05 02:51:37 +04:00
|
|
|
|
2004-06-07 03:52:08 +04:00
|
|
|
// *** removable media ***
|
|
|
|
// to be called when a medium change is detected to block subsequent commands
|
* 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
2008-08-06 01:11:51 +04:00
|
|
|
void (*media_changed)(scsi_periph_device device);
|
2004-06-07 03:52:08 +04:00
|
|
|
// convert result of *request to err_res
|
* 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
2008-08-06 01:11:51 +04:00
|
|
|
err_res (*check_error)(scsi_periph_device device, scsi_ccb *request);
|
2004-06-07 03:52:08 +04:00
|
|
|
// send start or stop command to device
|
* 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
2008-08-06 01:11:51 +04:00
|
|
|
// withLoadEject = true - include loading/ejecting,
|
|
|
|
// false - only do allow/deny
|
|
|
|
err_res (*send_start_stop)(scsi_periph_device device, scsi_ccb *request,
|
|
|
|
bool start, bool withLoadEject);
|
2004-06-07 03:52:08 +04:00
|
|
|
// checks media status and waits for device to become ready
|
2008-05-26 20:52:27 +04:00
|
|
|
// returns: B_OK, B_DEV_MEDIA_CHANGE_REQUESTED, B_NO_MEMORY or
|
2004-06-07 03:52:08 +04:00
|
|
|
// pending error reported by handle_get_error
|
* 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
2008-08-06 01:11:51 +04:00
|
|
|
status_t (*get_media_status)(scsi_periph_handle handle);
|
2004-06-07 03:52:08 +04:00
|
|
|
|
|
|
|
// compose device name consisting of prefix and path/target/LUN
|
|
|
|
// (result must be freed by caller)
|
2008-05-26 20:52:27 +04:00
|
|
|
char *(*compose_device_name)(device_node *device_node, const char *prefix);
|
2004-06-07 03:52:08 +04:00
|
|
|
} scsi_periph_interface;
|
|
|
|
|
|
|
|
#define SCSI_PERIPH_MODULE_NAME "generic/scsi_periph/v1"
|
|
|
|
|
2007-05-10 18:13:37 +04:00
|
|
|
#endif /* _SCSI_PERIPH_H */
|