Commit 4772b236 authored by Martin Dalecki's avatar Martin Dalecki Committed by Linus Torvalds

[PATCH] 2.5.7 IDE 24

- Push BAD_DMA_DRIVE and GOOD_DMA_DRIVE to the ide-pmac.c file, since this is
   the only place where those get used.

- Kill unused fields from the ide_task_s structure. In esp. we pass a task
   attached to a request and not the other way around!

- Rename hwif field to channel in struct ide_drive_s.

- Move the request queue to the level where proper serialization has to happen
   anyway - the channel structure.
parent 869cc357
......@@ -189,8 +189,6 @@ static ide_startstop_t chs_do_request(ide_drive_t *drive, struct request *rq, un
memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
ide_cmd_type_parser(&args);
args.rq = rq;
args.block = block;
rq->special = &args;
return ata_taskfile(drive,
......@@ -198,7 +196,7 @@ static ide_startstop_t chs_do_request(ide_drive_t *drive, struct request *rq, un
(struct hd_drive_hob_hdr *) &args.hobRegister,
args.handler,
args.prehandler,
args.rq);
rq);
}
static ide_startstop_t lba28_do_request(ide_drive_t *drive, struct request *rq, unsigned long block)
......@@ -235,8 +233,6 @@ static ide_startstop_t lba28_do_request(ide_drive_t *drive, struct request *rq,
memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
ide_cmd_type_parser(&args);
args.rq = rq;
args.block = block;
rq->special = &args;
return ata_taskfile(drive,
......@@ -244,7 +240,7 @@ static ide_startstop_t lba28_do_request(ide_drive_t *drive, struct request *rq,
(struct hd_drive_hob_hdr *) &args.hobRegister,
args.handler,
args.prehandler,
args.rq);
rq);
}
/*
......@@ -298,8 +294,6 @@ static ide_startstop_t lba48_do_request(ide_drive_t *drive, struct request *rq,
memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
ide_cmd_type_parser(&args);
args.rq = rq;
args.block = block;
rq->special = &args;
return ata_taskfile(drive,
......@@ -307,7 +301,7 @@ static ide_startstop_t lba48_do_request(ide_drive_t *drive, struct request *rq,
(struct hd_drive_hob_hdr *) &args.hobRegister,
args.handler,
args.prehandler,
args.rq);
rq);
}
/*
......
......@@ -71,6 +71,9 @@ enum {
#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
# define BAD_DMA_DRIVE 0
# define GOOD_DMA_DRIVE 1
typedef struct {
int accessTime;
int cycleTime;
......
......@@ -927,7 +927,7 @@ void ide_cmd_type_parser(ide_task_t *args)
/*
* This function is intended to be used prior to invoking ide_do_drive_cmd().
*/
static void ide_init_drive_taskfile (struct request *rq)
static void init_taskfile_request(struct request *rq)
{
memset(rq, 0, sizeof(*rq));
rq->flags = REQ_DRIVE_TASKFILE;
......@@ -935,11 +935,12 @@ static void ide_init_drive_taskfile (struct request *rq)
/*
* This is kept for internal use only !!!
* This is an internal call and nobody in user-space has a damn
* This is an internal call and nobody in user-space has a
* reason to call this taskfile.
*
* ide_raw_taskfile is the one that user-space executes.
*/
int ide_wait_taskfile(ide_drive_t *drive, struct hd_drive_task_hdr *taskfile, struct hd_drive_hob_hdr *hobfile, byte *buf)
{
struct request rq;
......@@ -965,7 +966,8 @@ int ide_wait_taskfile(ide_drive_t *drive, struct hd_drive_task_hdr *taskfile, st
args.hobRegister[IDE_SELECT_OFFSET_HOB] = hobfile->device_head;
args.hobRegister[IDE_CONTROL_OFFSET_HOB] = hobfile->control;
ide_init_drive_taskfile(&rq);
init_taskfile_request(&rq);
/* This is kept for internal use only !!! */
ide_cmd_type_parser(&args);
if (args.command_type != IDE_DRIVE_TASK_NO_DATA)
......@@ -973,59 +975,26 @@ int ide_wait_taskfile(ide_drive_t *drive, struct hd_drive_task_hdr *taskfile, st
rq.buffer = buf;
rq.special = &args;
return ide_do_drive_cmd(drive, &rq, ide_wait);
}
int ide_raw_taskfile(ide_drive_t *drive, ide_task_t *args, byte *buf)
{
struct request rq;
ide_init_drive_taskfile(&rq);
init_taskfile_request(&rq);
rq.buffer = buf;
if (args->command_type != IDE_DRIVE_TASK_NO_DATA)
rq.current_nr_sectors = rq.nr_sectors = (args->hobRegister[IDE_NSECTOR_OFFSET_HOB] << 8) | args->tfRegister[IDE_NSECTOR_OFFSET];
rq.special = args;
return ide_do_drive_cmd(drive, &rq, ide_wait);
}
/*
* The taskfile glue table
*
* reqtask.data_phase reqtask.req_cmd
* args.command_type args.handler
*
* TASKFILE_P_OUT_DMAQ ?? ??
* TASKFILE_P_IN_DMAQ ?? ??
* TASKFILE_P_OUT_DMA ?? ??
* TASKFILE_P_IN_DMA ?? ??
* TASKFILE_P_OUT ?? ??
* TASKFILE_P_IN ?? ??
*
* TASKFILE_OUT_DMAQ IDE_DRIVE_TASK_RAW_WRITE NULL
* TASKFILE_IN_DMAQ IDE_DRIVE_TASK_IN NULL
*
* TASKFILE_OUT_DMA IDE_DRIVE_TASK_RAW_WRITE NULL
* TASKFILE_IN_DMA IDE_DRIVE_TASK_IN NULL
*
* TASKFILE_IN_OUT ?? ??
*
* TASKFILE_MULTI_OUT IDE_DRIVE_TASK_RAW_WRITE task_mulout_intr
* TASKFILE_MULTI_IN IDE_DRIVE_TASK_IN task_mulin_intr
*
* TASKFILE_OUT IDE_DRIVE_TASK_RAW_WRITE task_out_intr
* TASKFILE_OUT IDE_DRIVE_TASK_OUT task_out_intr
*
* TASKFILE_IN IDE_DRIVE_TASK_IN task_in_intr
* TASKFILE_NO_DATA IDE_DRIVE_TASK_NO_DATA task_no_data_intr
*
* IDE_DRIVE_TASK_SET_XFER task_no_data_intr
* IDE_DRIVE_TASK_INVALID
*
*/
/*
* Issue ATA command and wait for completion. use for implementing commands in
* Issue ATA command and wait for completion. Use for implementing commands in
* kernel.
*
* The caller has to make sure buf is never NULL!
......
......@@ -288,7 +288,7 @@ static void init_hwif_data(ide_hwif_t *hwif, unsigned int index)
drive->type = ATA_DISK;
drive->select.all = (unit<<4)|0xa0;
drive->hwif = hwif;
drive->channel = hwif;
drive->ctl = 0x08;
drive->ready_stat = READY_STAT;
drive->bad_wstat = BAD_W_STAT;
......@@ -737,11 +737,6 @@ void ide_end_drive_cmd (ide_drive_t *drive, byte stat, byte err)
ide_task_t *args = (ide_task_t *) rq->special;
rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT);
if (args) {
if (args->tf_in_flags.b.data) {
unsigned short data = IN_WORD(IDE_DATA_REG);
args->tfRegister[IDE_DATA_OFFSET] = (data) & 0xFF;
args->hobRegister[IDE_DATA_OFFSET_HOB] = (data >> 8) & 0xFF;
}
args->tfRegister[IDE_ERROR_OFFSET] = err;
args->tfRegister[IDE_NSECTOR_OFFSET] = IN_BYTE(IDE_NSECTOR_REG);
args->tfRegister[IDE_SECTOR_OFFSET] = IN_BYTE(IDE_SECTOR_REG);
......
......@@ -664,6 +664,7 @@ static int pdc202xx_new_tune_chipset (ide_drive_t *drive, byte speed)
OUT_BYTE(0xac, datareg);
break;
default:
;
}
if (!drive->init_speed)
......
......@@ -658,9 +658,6 @@ ide_startstop_t promise_rw_disk (ide_drive_t *drive, struct request *rq, unsigne
/* We don't use the generic inerrupt handlers here? */
args.prehandler = NULL;
args.handler = NULL;
args.rq = rq;
args.block = block;
rq->special = NULL;
rq->special = &args;
return do_pdc4030_io(drive, &args);
......
......@@ -68,7 +68,7 @@ typedef unsigned char byte; /* used everywhere */
*/
#define DMA_PIO_RETRY 1 /* retrying in PIO */
#define HWIF(drive) ((drive)->hwif)
#define HWIF(drive) ((drive)->channel)
#define HWGROUP(drive) (HWIF(drive)->hwgroup)
/*
......@@ -175,17 +175,17 @@ typedef unsigned char byte; /* used everywhere */
#define WAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */
#define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */
#define SELECT_DRIVE(hwif,drive) \
#define SELECT_DRIVE(channel, drive) \
{ \
if (hwif->selectproc) \
hwif->selectproc(drive); \
OUT_BYTE((drive)->select.all, hwif->io_ports[IDE_SELECT_OFFSET]); \
if (channel->selectproc) \
channel->selectproc(drive); \
OUT_BYTE((drive)->select.all, channel->io_ports[IDE_SELECT_OFFSET]); \
}
#define SELECT_MASK(hwif,drive,mask) \
#define SELECT_MASK(channel, drive, mask) \
{ \
if (hwif->maskproc) \
hwif->maskproc(drive,mask); \
if (channel->maskproc) \
channel->maskproc(drive,mask); \
}
/*
......@@ -235,7 +235,6 @@ typedef struct hw_regs_s {
int irq; /* our irq number */
int dma; /* our dma entry */
ide_ack_intr_t *ack_intr; /* acknowledge interrupt */
void *priv; /* interface specific data */
hwif_chipset_t chipset;
} hw_regs_t;
......@@ -291,6 +290,8 @@ typedef union {
struct ide_settings_s;
typedef struct ide_drive_s {
struct hwif_s *channel; /* parent pointer to the channel we are attached to */
unsigned int usage; /* current "open()" count for drive */
char type; /* distingiush different devices: disk, cdrom, tape, floppy, ... */
......@@ -339,8 +340,8 @@ typedef struct ide_drive_s {
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 mult_req; /* requested multiple sector setting */
byte tune_req; /* requested drive tuning setting */
byte io_32bit; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */
byte bad_wstat; /* used for ignoring WRERR_STAT */
byte nowerr; /* used for ignoring WRERR_STAT */
......@@ -354,20 +355,25 @@ typedef struct ide_drive_s {
unsigned long capacity; /* total number of sectors */
unsigned long long capacity48; /* total number of sectors */
unsigned int drive_data; /* for use by tuneproc/selectproc as needed */
struct hwif_s *hwif; /* parent pointer to the interface we are attached to */
wait_queue_head_t wqueue; /* used to wait for drive in open() */
struct hd_driveid *id; /* drive model identification info */
struct hd_struct *part; /* drive partition table */
char name[4]; /* drive name, such as "hda" */
struct ata_operations *driver;
void *driver_data; /* extra driver data */
devfs_handle_t de; /* directory for device */
struct proc_dir_entry *proc; /* /proc/ide/ directory entry */
struct ide_settings_s *settings; /* /proc/ide/ drive settings */
char driver_req[10]; /* requests specific driver */
int last_lun; /* last logical unit */
int forced_lun; /* if hdxlun was given at boot */
int lun; /* logical unit */
int crc_count; /* crc counter to reduce drive speed */
byte quirk_list; /* drive is considered quirky if set for a specific host */
byte suspend_reset; /* drive suspend mode flag, soft-reset recovers */
......@@ -409,7 +415,7 @@ typedef int (ide_dmaproc_t)(ide_dma_action_t, ide_drive_t *);
*
* If it is not defined for a controller, standard-code is used from ide.c.
*
* Controllers which are not memory-mapped in the standard way need to
* Controllers which are not memory-mapped in the standard way need to
* override that mechanism using this function to work.
*
*/
......@@ -478,7 +484,7 @@ typedef struct hwif_s {
struct proc_dir_entry *proc; /* /proc/ide/ directory entry */
int irq; /* our irq number */
int major; /* our major number */
char name[80]; /* name of interface */
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 */
......@@ -781,15 +787,9 @@ void ide_end_drive_cmd (ide_drive_t *drive, byte stat, byte err);
typedef struct ide_task_s {
task_ioreg_t tfRegister[8];
task_ioreg_t hobRegister[8];
ide_reg_valid_t tf_out_flags;
ide_reg_valid_t tf_in_flags;
int data_phase;
int command_type;
ide_pre_handler_t *prehandler;
ide_handler_t *handler;
void *special; /* valid_t generally */
struct request *rq; /* copy of request */
unsigned long block; /* copy of block */
} ide_task_t;
void ata_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount);
......@@ -908,8 +908,6 @@ extern int ide_unregister_subdriver(ide_drive_t *drive);
void __init ide_scan_pcibus(int scan_direction);
#endif
#ifdef CONFIG_BLK_DEV_IDEDMA
# define BAD_DMA_DRIVE 0
# define GOOD_DMA_DRIVE 1
int ide_build_dmatable (ide_drive_t *drive, ide_dma_action_t func);
void ide_destroy_dmatable (ide_drive_t *drive);
ide_startstop_t ide_dma_intr (ide_drive_t *drive);
......
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