diff options
| author | Martin Dalecki <dalecki@evision-ventures.com> | 2002-05-21 21:24:23 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-05-21 21:24:23 -0700 |
| commit | c7c39840089beba1d84f2ed64f7760b726b251d8 (patch) | |
| tree | 9fe34c9fce15eb4ca5a9dd439c09eeb777d7ebfa /include/linux/atapi.h | |
| parent | 14cfb6a681f0ef9bbff1f08348f746be594e7e62 (diff) | |
[PATCH] 2.5.16 IDE 68
- Make the different ATAPI device type drivers use a unified packet command
structure. We have to start to push them together.
This patch is rather trivial in itself, but the plentora of code duplication it
is trying to fight against is making it unfortunately rather big...
Diffstat (limited to 'include/linux/atapi.h')
| -rw-r--r-- | include/linux/atapi.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/include/linux/atapi.h b/include/linux/atapi.h new file mode 100644 index 000000000000..6a6e2e36a6ff --- /dev/null +++ b/include/linux/atapi.h @@ -0,0 +1,65 @@ +/**** vi:set ts=8 sts=8 sw=8:************************************************ + * + * Copyright (C) 2002 Marcin Dalecki <martin@dalecki.de> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +/* + * With each packet command, we allocate a buffer. + * This is used for several packet + * commands (Not for READ/WRITE commands). + */ +#define IDEFLOPPY_PC_BUFFER_SIZE 256 +#define IDETAPE_PC_BUFFER_SIZE 256 + +/* This struct get's shared between different drivers. + */ +struct atapi_packet_command { + u8 c[12]; /* Actual packet bytes */ + char *buffer; /* Data buffer */ + int buffer_size; /* Size of our data buffer */ + char *current_position; /* Pointer into the above buffer */ + int request_transfer; /* Bytes to transfer */ + int actually_transferred; /* Bytes actually transferred */ + + unsigned long flags; /* Status/Action bit flags: long for set_bit */ + + /* FIXME: the following is ugly as hell, but the only way we can start + * actually to unify the code. + */ + /* driver specific data. */ + /* floppy/tape */ + int retries; /* On each retry, we increment retries */ + int error; /* Error code */ + char *b_data; /* Pointer which runs on the buffers */ + unsigned int b_count; /* Missing/Available data on the current buffer */ + u8 pc_buffer[IDEFLOPPY_PC_BUFFER_SIZE]; /* Temporary buffer */ + /* Called when this packet command is completed */ + void (*callback) (struct ata_device *, struct request *); + + /* only tape */ + struct bio *bio; + + /* only scsi */ + struct { + unsigned int b_count; /* Bytes transferred from current entry */ + struct scatterlist *sg; /* Scatter gather table */ + struct scsi_cmnd *scsi_cmd; /* SCSI command */ + void (*done)(struct scsi_cmnd *); /* Scsi completion routine */ + unsigned long timeout; /* Command timeout */ + } s; +}; + + +extern void atapi_discard_data(struct ata_device *drive, unsigned int bcount); +extern void atapi_write_zeros(struct ata_device *drive, unsigned int bcount); + +extern void atapi_init_pc(struct atapi_packet_command *pc); |
