Commit 9dbf0015 authored by Martin Dalecki's avatar Martin Dalecki Committed by Linus Torvalds

[PATCH] 2.5.10 IDE 42

- Streamline the usage of sector_t over the strategy routines in question a
   bit. Streamline the do_request code in ide-disk.c.

- Improve the readability of start_request in ide.c.

- Remove obsolete/nowhere used stuff from hdreg.h.

- Splitup special_t into classical flag field.

- Use only a single field to determine the capacity of a drive.  Make this
   field and the code paths it follows as far as possible use the sector_t
   instead of a hard coded integer types.  This increases the chances that at
   some distant point in time we will indeed be able to use 64 bit wide sector_t
   entities. (Disks are getting huge those times now...)
parent f62e2b90
......@@ -732,15 +732,12 @@ static struct ioctl32_list ioctl32_handler_table[] = {
IOCTL32_HANDLER(HDIO_GETGEO, hdio_getgeo), /* hdreg.h ioctls */
IOCTL32_HANDLER(HDIO_GET_UNMASKINTR, hdio_ioctl_trans),
IOCTL32_HANDLER(HDIO_GET_MULTCOUNT, hdio_ioctl_trans),
// HDIO_OBSOLETE_IDENTITY
IOCTL32_HANDLER(HDIO_GET_KEEPSETTINGS, hdio_ioctl_trans),
IOCTL32_HANDLER(HDIO_GET_32BIT, hdio_ioctl_trans),
IOCTL32_HANDLER(HDIO_GET_NOWERR, hdio_ioctl_trans),
IOCTL32_HANDLER(HDIO_GET_DMA, hdio_ioctl_trans),
IOCTL32_HANDLER(HDIO_GET_NICE, hdio_ioctl_trans),
IOCTL32_DEFAULT(HDIO_GET_IDENTITY),
// HDIO_TRISTATE_HWIF /* not implemented */
// HDIO_DRIVE_TASK /* To do, need specs */
IOCTL32_DEFAULT(HDIO_DRIVE_CMD),
IOCTL32_DEFAULT(HDIO_SET_MULTCOUNT),
IOCTL32_DEFAULT(HDIO_SET_UNMASKINTR),
......
......@@ -338,7 +338,7 @@ void blk_queue_assign_lock(request_queue_t *q, spinlock_t *lock)
static char *rq_flags[] = { "REQ_RW", "REQ_RW_AHEAD", "REQ_BARRIER",
"REQ_CMD", "REQ_NOMERGE", "REQ_STARTED",
"REQ_DONTPREP", "REQ_DRIVE_CMD", "REQ_DRIVE_TASK",
"REQ_DONTPREP", "REQ_DRIVE_CMD",
"REQ_DRIVE_ACB", "REQ_PC", "REQ_BLOCK_PC",
"REQ_SENSE", "REQ_SPECIAL" };
......
......@@ -1162,11 +1162,12 @@ static ide_startstop_t cdrom_seek_intr (ide_drive_t *drive)
return ide_stopped;
}
static ide_startstop_t cdrom_start_seek_continuation (ide_drive_t *drive)
static ide_startstop_t cdrom_start_seek_continuation(struct ata_device *drive)
{
unsigned char cmd[CDROM_PACKET_SIZE];
struct request *rq = HWGROUP(drive)->rq;
int sector, frame, nskip;
sector_t sector;
int frame, nskip;
sector = rq->sector;
nskip = (sector % SECTORS_PER_FRAME);
......@@ -1181,14 +1182,14 @@ static ide_startstop_t cdrom_start_seek_continuation (ide_drive_t *drive)
return cdrom_transfer_packet_command(drive, cmd, WAIT_CMD, &cdrom_seek_intr);
}
static ide_startstop_t cdrom_start_seek (ide_drive_t *drive, unsigned int block)
static ide_startstop_t cdrom_start_seek(struct ata_device *drive, sector_t block)
{
struct cdrom_info *info = drive->driver_data;
info->dma = 0;
info->cmd = 0;
info->start_seek = jiffies;
return cdrom_start_packet_command (drive, 0, cdrom_start_seek_continuation);
return cdrom_start_packet_command(drive, 0, cdrom_start_seek_continuation);
}
/*
......@@ -1199,7 +1200,7 @@ static ide_startstop_t cdrom_start_seek (ide_drive_t *drive, unsigned int block)
static void restore_request (struct request *rq)
{
if (rq->buffer != bio_data(rq->bio)) {
int n = (rq->buffer - (char *) bio_data(rq->bio)) / SECTOR_SIZE;
sector_t n = (rq->buffer - (char *) bio_data(rq->bio)) / SECTOR_SIZE;
rq->buffer = bio_data(rq->bio);
rq->nr_sectors += n;
rq->sector -= n;
......@@ -1213,7 +1214,7 @@ static void restore_request (struct request *rq)
/*
* Start a read request from the CD-ROM.
*/
static ide_startstop_t cdrom_start_read (ide_drive_t *drive, unsigned int block)
static ide_startstop_t cdrom_start_read(struct ata_device *drive, sector_t block)
{
struct cdrom_info *info = drive->driver_data;
struct request *rq = HWGROUP(drive)->rq;
......@@ -1634,8 +1635,6 @@ ide_cdrom_do_request(struct ata_device *drive, struct request *rq, sector_t bloc
struct cdrom_info *info = drive->driver_data;
if (rq->flags & REQ_CMD) {
if (CDROM_CONFIG_FLAGS(drive)->seeking) {
unsigned long elpased = jiffies - info->start_seek;
int stat = GET_STAT();
......@@ -1650,7 +1649,7 @@ ide_cdrom_do_request(struct ata_device *drive, struct request *rq, sector_t bloc
CDROM_CONFIG_FLAGS(drive)->seeking = 0;
}
if (IDE_LARGE_SEEK(info->last_block, block, IDECD_SEEK_THRESHOLD) && drive->dsc_overlap)
action = cdrom_start_seek (drive, block);
action = cdrom_start_seek(drive, block);
else {
if (rq_data_dir(rq) == READ)
action = cdrom_start_read(drive, block);
......@@ -1837,7 +1836,7 @@ static int cdrom_eject(ide_drive_t *drive, int ejectflag,
return cdrom_queue_packet_command(drive, cmd, sense, &pc);
}
static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,
static int cdrom_read_capacity(ide_drive_t *drive, u32 *capacity,
struct request_sense *sense)
{
struct {
......@@ -2027,7 +2026,8 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
/* Now try to get the total cdrom capacity. */
minor = (drive->select.b.unit) << PARTN_BITS;
dev = mk_kdev(drive->channel->major, minor);
stat = cdrom_get_last_written(dev, &toc->capacity);
/* FIXME: This is making worng assumptions about register layout. */
stat = cdrom_get_last_written(dev, (unsigned long *) &toc->capacity);
if (stat)
stat = cdrom_read_capacity(drive, &toc->capacity, sense);
if (stat)
......@@ -2686,7 +2686,7 @@ static void ide_cdrom_add_settings(ide_drive_t *drive)
}
static
int ide_cdrom_setup (ide_drive_t *drive)
int ide_cdrom_setup(ide_drive_t *drive)
{
struct cdrom_info *info = drive->driver_data;
struct cdrom_device_info *cdi = &info->devinfo;
......@@ -2702,7 +2702,6 @@ int ide_cdrom_setup (ide_drive_t *drive)
blk_queue_prep_rq(&drive->queue, ll_10byte_cmd_build);
drive->special.all = 0;
drive->ready_stat = 0;
CDROM_STATE_FLAGS (drive)->media_changed = 1;
......@@ -2891,10 +2890,9 @@ void ide_cdrom_revalidate (ide_drive_t *drive)
set_blocksize(mk_kdev(drive->channel->major, minor), CD_FRAMESIZE);
}
static
unsigned long ide_cdrom_capacity (ide_drive_t *drive)
static sector_t ide_cdrom_capacity(struct ata_device *drive)
{
unsigned long capacity;
u32 capacity;
if (cdrom_read_capacity(drive, &capacity, NULL))
return 0;
......@@ -2934,9 +2932,7 @@ static struct ata_operations ide_cdrom_driver = {
release: ide_cdrom_release,
check_media_change: ide_cdrom_check_media_change,
revalidate: ide_cdrom_revalidate,
pre_reset: NULL,
capacity: ide_cdrom_capacity,
special: NULL,
proc: NULL
};
......
......@@ -151,12 +151,11 @@ struct atapi_toc_entry {
};
struct atapi_toc {
int last_session_lba;
int xa_flag;
unsigned long capacity;
int last_session_lba;
int xa_flag;
u32 capacity;
struct atapi_toc_header hdr;
struct atapi_toc_entry ent[MAX_TRACKS+1];
/* One extra for the leadout. */
struct atapi_toc_entry ent[MAX_TRACKS+1]; /* one extra for the leadout. */
};
......
This diff is collapsed.
......@@ -295,7 +295,7 @@ int ide_build_dmatable (ide_drive_t *drive, ide_dma_action_t func)
int i;
struct scatterlist *sg;
if (HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE) {
if (HWGROUP(drive)->rq->flags & REQ_DRIVE_ACB) {
hwif->sg_nents = i = raw_build_sglist(hwif, HWGROUP(drive)->rq);
} else {
hwif->sg_nents = i = ide_build_sglist(hwif, HWGROUP(drive)->rq);
......@@ -590,9 +590,10 @@ int ide_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, dma_timer_expiry); /* issue cmd to drive */
if ((HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE) &&
if ((HWGROUP(drive)->rq->flags & REQ_DRIVE_ACB) &&
(drive->addressing == 1)) {
struct ata_taskfile *args = HWGROUP(drive)->rq->special;
OUT_BYTE(args->taskfile.command, IDE_COMMAND_REG);
} else if (drive->addressing) {
OUT_BYTE(reading ? WIN_READDMA_EXT : WIN_WRITEDMA_EXT, IDE_COMMAND_REG);
......
......@@ -1255,12 +1255,12 @@ static void idefloppy_create_test_unit_ready_cmd(idefloppy_pc_t *pc)
pc->c[0] = IDEFLOPPY_TEST_UNIT_READY_CMD;
}
static void idefloppy_create_rw_cmd (idefloppy_floppy_t *floppy, idefloppy_pc_t *pc, struct request *rq, unsigned long sector)
static void idefloppy_create_rw_cmd(idefloppy_floppy_t *floppy, idefloppy_pc_t *pc, struct request *rq, sector_t sector)
{
int block = sector / floppy->bs_factor;
int blocks = rq->nr_sectors / floppy->bs_factor;
int cmd = rq_data_dir(rq);
#if IDEFLOPPY_DEBUG_LOG
printk ("create_rw1%d_cmd: block == %d, blocks == %d\n",
2 * test_bit (IDEFLOPPY_USE_READ12, &floppy->flags), block, blocks);
......@@ -1287,9 +1287,9 @@ static void idefloppy_create_rw_cmd (idefloppy_floppy_t *floppy, idefloppy_pc_t
}
/*
* idefloppy_do_request is our request handling function.
* This is our request handling function.
*/
static ide_startstop_t idefloppy_do_request (ide_drive_t *drive, struct request *rq, unsigned long block)
static ide_startstop_t idefloppy_do_request(struct ata_device *drive, struct request *rq, sector_t block)
{
idefloppy_floppy_t *floppy = drive->driver_data;
idefloppy_pc_t *pc;
......@@ -1297,7 +1297,7 @@ static ide_startstop_t idefloppy_do_request (ide_drive_t *drive, struct request
#if IDEFLOPPY_DEBUG_LOG
printk (KERN_INFO "rq_status: %d, rq_dev: %u, flags: %lx, errors: %d\n",rq->rq_status,(unsigned int) rq->rq_dev,rq->flags,rq->errors);
printk (KERN_INFO "sector: %ld, nr_sectors: %ld, current_nr_sectors: %d\n",rq->sector,rq->nr_sectors,rq->current_nr_sectors);
#endif /* IDEFLOPPY_DEBUG_LOG */
#endif
if (rq->errors >= ERROR_MAX) {
if (floppy->failed_pc != NULL)
......@@ -1314,7 +1314,7 @@ static ide_startstop_t idefloppy_do_request (ide_drive_t *drive, struct request
idefloppy_end_request(drive, 0);
return ide_stopped;
}
pc = idefloppy_next_pc_storage (drive);
pc = idefloppy_next_pc_storage(drive);
idefloppy_create_rw_cmd (floppy, pc, rq, block);
} else if (rq->flags & IDEFLOPPY_RQ) {
pc = (idefloppy_pc_t *) rq->buffer;
......@@ -2063,9 +2063,7 @@ static struct ata_operations idefloppy_driver = {
release: idefloppy_release,
check_media_change: idefloppy_check_media_change,
revalidate: NULL, /* use default method */
pre_reset: NULL,
capacity: idefloppy_capacity,
special: NULL,
proc: idefloppy_proc
};
......
......@@ -1109,7 +1109,7 @@ pmac_ide_build_dmatable(ide_drive_t *drive, int ix, int wr)
udelay(1);
/* Build sglist */
if (rq->flags & REQ_DRIVE_TASKFILE) {
if (rq->flags & REQ_DRIVE_ACB) {
pmac_ide[ix].sg_nents = i = pmac_raw_build_sglist(ix, rq);
} else {
pmac_ide[ix].sg_nents = i = pmac_ide_build_sglist(ix, rq);
......@@ -1386,7 +1386,7 @@ int pmac_ide_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
return 0;
BUG_ON(HWGROUP(drive)->handler);
ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);
if ((HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE) &&
if ((HWGROUP(drive)->rq->flags & REQ_DRIVE_ACB) &&
(drive->addressing == 1)) {
struct ata_taskfile *args = HWGROUP(drive)->rq->special;
OUT_BYTE(args->taskfile.command, IDE_COMMAND_REG);
......
......@@ -160,8 +160,8 @@ static int proc_ide_read_imodel
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
}
static int proc_ide_read_channel
(char *page, char **start, off_t off, int count, int *eof, void *data)
static int proc_ide_read_channel(char *page, char **start,
off_t off, int count, int *eof, void *data)
{
struct ata_channel *hwif = data;
int len;
......
......@@ -2614,9 +2614,9 @@ static void idetape_create_write_cmd (idetape_tape_t *tape, idetape_pc_t *pc, un
}
/*
* idetape_do_request is our request handling function.
* This is our request handling function.
*/
static ide_startstop_t idetape_do_request (ide_drive_t *drive, struct request *rq, unsigned long block)
static ide_startstop_t idetape_do_request(struct ata_device *drive, struct request *rq, sector_t block)
{
idetape_tape_t *tape = drive->driver_data;
idetape_pc_t *pc;
......
......@@ -476,15 +476,15 @@ ide_startstop_t ata_taskfile(ide_drive_t *drive,
/*
* This is invoked on completion of a WIN_SETMULT cmd.
*/
ide_startstop_t set_multmode_intr (ide_drive_t *drive)
ide_startstop_t set_multmode_intr(struct ata_device *drive)
{
byte stat;
u8 stat;
if (OK_STAT(stat=GET_STAT(),READY_STAT,BAD_STAT)) {
drive->mult_count = drive->mult_req;
} else {
drive->mult_req = drive->mult_count = 0;
drive->special.b.recalibrate = 1;
drive->special_cmd |= ATA_SPECIAL_RECALIBRATE;
ide_dump_status(drive, "set_multmode", stat);
}
return ide_stopped;
......@@ -879,20 +879,12 @@ void ide_cmd_type_parser(struct ata_taskfile *args)
}
}
/*
* This function is intended to be used prior to invoking ide_do_drive_cmd().
*/
static void init_taskfile_request(struct request *rq)
{
memset(rq, 0, sizeof(*rq));
rq->flags = REQ_DRIVE_TASKFILE;
}
int ide_raw_taskfile(ide_drive_t *drive, struct ata_taskfile *args, byte *buf)
{
struct request rq;
init_taskfile_request(&rq);
memset(&rq, 0, sizeof(rq));
rq.flags = REQ_DRIVE_ACB;
rq.buffer = buf;
if (args->command_type != IDE_DRIVE_TASK_NO_DATA)
......@@ -909,13 +901,8 @@ int ide_raw_taskfile(ide_drive_t *drive, struct ata_taskfile *args, byte *buf)
* Implement generic ioctls invoked from userspace to imlpement specific
* functionality.
*
* FIXME:
*
* 1. Rewrite hdparm to use the ide_task_ioctl function.
*
* 2. Publish it.
*
* 3. Kill this and HDIO_DRIVE_CMD alltogether.
* Unfortunately every single low level programm out there is using this
* interface.
*/
int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
......@@ -923,22 +910,19 @@ int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
int err = 0;
u8 vals[4];
u8 *argbuf = vals;
byte xfer_rate = 0;
u8 xfer_rate = 0;
int argsize = 4;
struct ata_taskfile args;
struct request rq;
/*
* First phase.
ide_init_drive_cmd(&rq);
/* Wait for drive ready.
*/
if (NULL == (void *) arg) {
struct request rq;
ide_init_drive_cmd(&rq);
if (!arg)
return ide_do_drive_cmd(drive, &rq, ide_wait);
}
/*
* Second phase.
/* Second phase.
*/
if (copy_from_user(vals, (void *)arg, 4))
return -EFAULT;
......@@ -960,6 +944,8 @@ int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
memset(argbuf + 4, 0, argsize - 4);
}
/* Always make sure the transfer reate has been setup.
*/
if (set_transfer(drive, &args)) {
xfer_rate = vals[1];
if (ide_ata66_check(drive, &args))
......@@ -968,7 +954,6 @@ int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
/* Issue ATA command and wait for completion.
*/
ide_init_drive_cmd(&rq);
rq.buffer = argbuf;
err = ide_do_drive_cmd(drive, &rq, ide_wait);
......@@ -978,44 +963,22 @@ int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
drive->channel->speedproc(drive, xfer_rate);
ide_driveid_update(drive);
}
abort:
if (copy_to_user((void *)arg, argbuf, argsize))
err = -EFAULT;
if (argsize > 4)
kfree(argbuf);
return err;
}
int ide_task_ioctl(ide_drive_t *drive, unsigned long arg)
{
int err = 0;
u8 args[7];
u8 *argbuf;
int argsize = 7;
struct request rq;
argbuf = args;
if (copy_from_user(args, (void *)arg, 7))
return -EFAULT;
ide_init_drive_cmd(&rq);
rq.flags = REQ_DRIVE_TASK;
rq.buffer = argbuf;
err = ide_do_drive_cmd(drive, &rq, ide_wait);
if (copy_to_user((void *)arg, argbuf, argsize))
err = -EFAULT;
return err;
}
EXPORT_SYMBOL(drive_is_ready);
EXPORT_SYMBOL(ata_read);
EXPORT_SYMBOL(ata_write);
EXPORT_SYMBOL(atapi_read);
EXPORT_SYMBOL(atapi_write);
EXPORT_SYMBOL(ata_taskfile);
EXPORT_SYMBOL(recal_intr);
EXPORT_SYMBOL(set_geometry_intr);
......@@ -1023,6 +986,4 @@ EXPORT_SYMBOL(set_multmode_intr);
EXPORT_SYMBOL(task_no_data_intr);
EXPORT_SYMBOL(ide_raw_taskfile);
EXPORT_SYMBOL(ide_cmd_type_parser);
EXPORT_SYMBOL(ide_cmd_ioctl);
EXPORT_SYMBOL(ide_task_ioctl);
This diff is collapsed.
......@@ -458,9 +458,9 @@ static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc)
}
/*
* idescsi_do_request is our request handling function.
* This is our request handling function.
*/
static ide_startstop_t idescsi_do_request (ide_drive_t *drive, struct request *rq, unsigned long block)
static ide_startstop_t idescsi_do_request(struct ata_device *drive, struct request *rq, sector_t block)
{
#if IDESCSI_DEBUG_LOG
printk (KERN_INFO "rq_status: %d, rq_dev: %u, cmd: %d, errors: %d\n",rq->rq_status,(unsigned int) rq->rq_dev,rq->cmd,rq->errors);
......@@ -468,20 +468,20 @@ static ide_startstop_t idescsi_do_request (ide_drive_t *drive, struct request *r
#endif /* IDESCSI_DEBUG_LOG */
if (rq->flags & REQ_SPECIAL) {
return idescsi_issue_pc (drive, (idescsi_pc_t *) rq->special);
return idescsi_issue_pc(drive, (idescsi_pc_t *) rq->special);
}
blk_dump_rq_flags(rq, "ide-scsi: unsup command");
idescsi_end_request(drive, 0);
return ide_stopped;
}
static int idescsi_open (struct inode *inode, struct file *filp, ide_drive_t *drive)
static int idescsi_open(struct inode *inode, struct file *filp, struct ata_device *drive)
{
MOD_INC_USE_COUNT;
return 0;
}
static void idescsi_ide_release (struct inode *inode, struct file *filp, ide_drive_t *drive)
static void idescsi_ide_release(struct inode *inode, struct file *filp, struct ata_device *drive)
{
MOD_DEC_USE_COUNT;
}
......@@ -556,9 +556,7 @@ static struct ata_operations idescsi_driver = {
release: idescsi_ide_release,
check_media_change: NULL,
revalidate: idescsi_revalidate,
pre_reset: NULL,
capacity: NULL,
special: NULL,
proc: NULL
};
......
......@@ -76,17 +76,16 @@ enum rq_flag_bits {
__REQ_STARTED, /* drive already may have started this one */
__REQ_DONTPREP, /* don't call prep for this one */
/*
* for IDE
*/
* for ATA/ATAPI devices
*/
__REQ_DRIVE_CMD,
__REQ_DRIVE_TASK,
__REQ_DRIVE_ACB,
__REQ_PC, /* packet command (special) */
__REQ_BLOCK_PC, /* queued down pc from block layer */
__REQ_SENSE, /* sense retrival */
__REQ_SPECIAL, /* driver special command */
__REQ_SPECIAL, /* driver special command (currently reset) */
__REQ_NR_BITS, /* stops here */
};
......@@ -99,15 +98,12 @@ enum rq_flag_bits {
#define REQ_STARTED (1 << __REQ_STARTED)
#define REQ_DONTPREP (1 << __REQ_DONTPREP)
#define REQ_DRIVE_CMD (1 << __REQ_DRIVE_CMD)
#define REQ_DRIVE_TASK (1 << __REQ_DRIVE_TASK)
#define REQ_DRIVE_ACB (1 << __REQ_DRIVE_ACB)
#define REQ_PC (1 << __REQ_PC)
#define REQ_SENSE (1 << __REQ_SENSE)
#define REQ_BLOCK_PC (1 << __REQ_BLOCK_PC)
#define REQ_SENSE (1 << __REQ_SENSE)
#define REQ_SPECIAL (1 << __REQ_SPECIAL)
#define REQ_DRIVE_TASKFILE REQ_DRIVE_ACB
#include <linux/elevator.h>
typedef int (merge_request_fn) (request_queue_t *, struct request *,
......
......@@ -3,7 +3,7 @@
/*
* This file contains some defines for the AT-hd-controller.
* Various sources.
* Various sources.
*/
#define HD_IRQ 14 /* the standard disk interrupt */
......@@ -51,11 +51,9 @@
/*
* Command Header sizes for IOCTL commands
* HDIO_DRIVE_CMD and HDIO_DRIVE_TASK
*/
#define HDIO_DRIVE_CMD_HDR_SIZE (4 * sizeof(u8))
#define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(u8))
#define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(u8))
#define IDE_DRIVE_TASK_INVALID -1
......@@ -287,7 +285,6 @@ struct hd_big_geometry {
#define HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */
#define HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */
#define HDIO_GET_QDMA 0x0305 /* get use-qdma flag */
#define HDIO_OBSOLETE_IDENTITY 0x0307 /* OBSOLETE, DO NOT USE: returns 142 bytes */
#define HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */
#define HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */
#define HDIO_GET_DMA 0x030b /* get use-dma flag */
......@@ -298,12 +295,8 @@ struct hd_big_geometry {
#define HDIO_GET_ADDRESS 0x0310 /* */
#define HDIO_GET_BUSSTATE 0x031a /* get the bus state of the hwif */
#define HDIO_TRISTATE_HWIF 0x031b /* execute a channel tristate */
#define HDIO_DRIVE_TASK 0x031e /* execute task and special drive command */
#define HDIO_DRIVE_CMD 0x031f /* execute a special drive command */
#define HDIO_DRIVE_CMD_AEB HDIO_DRIVE_TASK
/* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
#define HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */
#define HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */
......@@ -521,11 +514,7 @@ struct hd_driveid {
* 7:0 current value
*/
unsigned short words95_99[5]; /* reserved words 95-99 */
#if 0
unsigned short words100_103[4] ;/* reserved words 100-103 */
#else
unsigned long long lba_capacity_2;/* 48-bit total number of sectors */
#endif
unsigned short words104_125[22];/* reserved words 104-125 */
unsigned short last_lun; /* (word 126) */
unsigned short word127; /* (word 127) Feature Set
......@@ -573,7 +562,7 @@ struct hd_driveid {
* 15:8 Checksum
* 7:0 Signature
*/
};
} __attribute__((packed));
/*
* IDE "nice" flags. These are used on a per drive basis to determine
......
......@@ -33,23 +33,26 @@
*/
#define INITIAL_MULT_COUNT 0 /* off=0; on=2,4,8,16,32, etc.. */
#ifndef SUPPORT_SLOW_DATA_PORTS /* 1 to support slow data ports */
#define SUPPORT_SLOW_DATA_PORTS 1 /* 0 to reduce kernel size */
#ifndef SUPPORT_SLOW_DATA_PORTS /* 1 to support slow data ports */
# define SUPPORT_SLOW_DATA_PORTS 1 /* 0 to reduce kernel size */
#endif
/* Right now this is only needed by a promise controlled.
*/
#ifndef SUPPORT_VLB_SYNC /* 1 to support weird 32-bit chips */
#define SUPPORT_VLB_SYNC 1 /* 0 to reduce kernel size */
# define SUPPORT_VLB_SYNC 1 /* 0 to reduce kernel size */
#endif
#ifndef DISK_RECOVERY_TIME /* off=0; on=access_delay_time */
#define DISK_RECOVERY_TIME 0 /* for hardware that needs it */
# define DISK_RECOVERY_TIME 0 /* for hardware that needs it */
#endif
#ifndef OK_TO_RESET_CONTROLLER /* 1 needed for good error recovery */
#define OK_TO_RESET_CONTROLLER 1 /* 0 for use with AH2372A/B interface */
# define OK_TO_RESET_CONTROLLER 1 /* 0 for use with AH2372A/B interface */
#endif
#ifndef FANCY_STATUS_DUMPS /* 1 for human-readable drive errors */
#define FANCY_STATUS_DUMPS 1 /* 0 to reduce kernel size */
# define FANCY_STATUS_DUMPS 1 /* 0 to reduce kernel size */
#endif
#ifndef DISABLE_IRQ_NOSYNC
#define DISABLE_IRQ_NOSYNC 0
# define DISABLE_IRQ_NOSYNC 0
#endif
/*
......@@ -262,17 +265,6 @@ void ide_setup_ports(hw_regs_t *hw,
#define ATA_SCSI 0x21
#define ATA_NO_LUN 0x7f
typedef union {
unsigned all : 8; /* all of the bits together */
struct {
unsigned set_geometry : 1; /* respecify drive geometry */
unsigned recalibrate : 1; /* seek to cyl 0 */
unsigned set_multmode : 1; /* set multmode count */
unsigned set_tune : 1; /* tune interface for drive */
unsigned reserved : 4; /* unused */
} b;
} special_t;
struct ide_settings_s;
/* structure describing an ATA/ATAPI device */
typedef
......@@ -300,7 +292,17 @@ struct ata_device {
unsigned long PADAM_service_time; /* service time of last request */
unsigned long PADAM_timeout; /* max time to wait for irq */
special_t special; /* special action flags */
/* Flags requesting/indicating one of the following special commands
* executed on the request queue.
*/
#define ATA_SPECIAL_GEOMETRY 0x01
#define ATA_SPECIAL_RECALIBRATE 0x02
#define ATA_SPECIAL_MMODE 0x04
#define ATA_SPECIAL_TUNE 0x08
unsigned char special_cmd;
u8 mult_req; /* requested multiple sector setting */
u8 tune_req; /* requested drive tuning setting */
byte using_dma; /* disk is using dma for read/write */
byte retry_pio; /* retrying dma capable host in pio */
byte state; /* retry state */
......@@ -327,8 +329,6 @@ struct ata_device {
byte ctl; /* "normal" value for IDE_CONTROL_REG */
byte ready_stat; /* min status value for drive ready */
byte mult_count; /* current multiple sector setting */
byte mult_req; /* requested multiple sector setting */
byte tune_req; /* requested drive tuning setting */
byte bad_wstat; /* used for ignoring WRERR_STAT */
byte nowerr; /* used for ignoring WRERR_STAT */
byte sect0; /* offset of first sector for DM6:DDO */
......@@ -338,8 +338,7 @@ struct ata_device {
byte bios_sect; /* BIOS/fdisk/LILO sectors per track */
unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */
unsigned int cyl; /* "real" number of cyls */
unsigned long capacity; /* total number of sectors */
unsigned long long capacity48; /* total number of sectors */
u64 capacity; /* total number of sectors */
unsigned int drive_data; /* for use by tuneproc/selectproc as needed */
wait_queue_head_t wqueue; /* used to wait for drive in open() */
......@@ -462,19 +461,19 @@ struct ata_channel {
char name[8]; /* name of interface */
int index; /* 0 for ide0; 1 for ide1; ... */
hwif_chipset_t chipset; /* sub-module for tuning.. */
unsigned noprobe : 1; /* don't probe for this interface */
unsigned present : 1; /* there is a device on this interface */
unsigned serialized : 1; /* serialized operation between channels */
unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */
unsigned reset : 1; /* reset after probe */
unsigned autodma : 1; /* automatically try to enable DMA at boot */
unsigned udma_four : 1; /* 1=ATA-66 capable, 0=default */
unsigned highmem : 1; /* can do full 32-bit dma */
byte slow; /* flag: slow data port */
unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */
unsigned noprobe : 1; /* don't probe for this interface */
unsigned present : 1; /* there is a device on this interface */
unsigned serialized : 1; /* serialized operation between channels */
unsigned sharing_irq : 1; /* 1 = sharing irq with another hwif */
unsigned reset : 1; /* reset after probe */
unsigned autodma : 1; /* automatically try to enable DMA at boot */
unsigned udma_four : 1; /* 1=ATA-66 capable, 0=default */
unsigned highmem : 1; /* can do full 32-bit dma */
unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */
unsigned no_unmask : 1; /* disallow setting unmask bit */
byte io_32bit; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */
unsigned no_unmask : 1; /* disallow setting unmask bit */
byte unmask; /* flag: okay to unmask other irqs */
byte slow; /* flag: slow data port */
#if (DISK_RECOVERY_TIME > 0)
unsigned long last_time; /* time when previous rq was done */
......@@ -616,20 +615,20 @@ read_proc_t proc_ide_read_geometry;
struct ata_operations {
struct module *owner;
int (*cleanup)(ide_drive_t *);
int (*standby)(ide_drive_t *);
ide_startstop_t (*do_request)(ide_drive_t *, struct request *, unsigned long);
int (*end_request)(ide_drive_t *drive, int uptodate);
int (*cleanup)(struct ata_device *);
int (*standby)(struct ata_device *);
ide_startstop_t (*do_request)(struct ata_device *, struct request *, sector_t);
int (*end_request)(struct ata_device *, int);
int (*ioctl)(ide_drive_t *, struct inode *, struct file *, unsigned int, unsigned long);
int (*open)(struct inode *, struct file *, ide_drive_t *);
void (*release)(struct inode *, struct file *, ide_drive_t *);
int (*check_media_change)(ide_drive_t *);
void (*revalidate)(ide_drive_t *);
int (*ioctl)(struct ata_device *, struct inode *, struct file *, unsigned int, unsigned long);
int (*open)(struct inode *, struct file *, struct ata_device *);
void (*release)(struct inode *, struct file *, struct ata_device *);
int (*check_media_change)(struct ata_device *);
void (*revalidate)(struct ata_device *);
void (*pre_reset)(ide_drive_t *);
unsigned long (*capacity)(ide_drive_t *);
ide_startstop_t (*special)(ide_drive_t *);
void (*pre_reset)(struct ata_device *);
sector_t (*capacity)(struct ata_device *);
ide_startstop_t (*special)(struct ata_device *);
ide_proc_entry_t *proc;
};
......@@ -646,7 +645,7 @@ do { \
__MOD_DEC_USE_COUNT((ata)->owner); \
} while(0)
extern unsigned long ata_capacity(ide_drive_t *drive);
extern sector_t ata_capacity(struct ata_device *drive);
/* FIXME: Actually implement and use them as soon as possible! to make the
* ide_scan_devices() go away! */
......@@ -733,7 +732,6 @@ ide_startstop_t restart_request(ide_drive_t *);
* This function is intended to be used prior to invoking ide_do_drive_cmd().
*/
extern void ide_init_drive_cmd(struct request *rq);
extern void init_taskfile_request(struct request *rq);
/*
* "action" parameter type for ide_do_drive_cmd() below.
......@@ -787,10 +785,8 @@ extern ide_startstop_t task_no_data_intr(ide_drive_t *drive);
/* This is setting up all fields in args, which depend upon the command type.
*/
extern void ide_cmd_type_parser(struct ata_taskfile *args);
extern int ide_raw_taskfile(ide_drive_t *drive, struct ata_taskfile *cmd, byte *buf);
extern int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg);
extern int ide_task_ioctl(ide_drive_t *drive, unsigned long arg);
extern int ide_raw_taskfile(struct ata_device *drive, struct ata_taskfile *cmd, byte *buf);
extern int ide_cmd_ioctl(struct ata_device *drive, unsigned long arg);
void ide_delay_50ms(void);
......@@ -864,13 +860,13 @@ extern int ide_register_subdriver(ide_drive_t *drive, struct ata_operations *dri
extern int ide_unregister_subdriver(ide_drive_t *drive);
#ifdef CONFIG_BLK_DEV_IDEPCI
#define ON_BOARD 1
#define NEVER_BOARD 0
#ifdef CONFIG_BLK_DEV_OFFBOARD
# define OFF_BOARD ON_BOARD
#else
# define OFF_BOARD NEVER_BOARD
#endif
# define ON_BOARD 1
# define NEVER_BOARD 0
# ifdef CONFIG_BLK_DEV_OFFBOARD
# define OFF_BOARD ON_BOARD
# else
# define OFF_BOARD NEVER_BOARD
# endif
void __init ide_scan_pcibus(int scan_direction);
#endif
......@@ -892,4 +888,4 @@ extern spinlock_t ide_lock;
extern int drive_is_ready(ide_drive_t *drive);
extern void revalidate_drives(void);
#endif /* _IDE_H */
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment