Commit 556a2071 authored by Oleg Drokin's avatar Oleg Drokin

Merge angband.namesys.com:/home/green/bk/linux-2.5

into angband.namesys.com:/home/green/bk_work/reiser3-linux-2.5
parents 7bbbc1b5 50da7d0e
......@@ -3,6 +3,8 @@
* Split out from setup.c by davej@suse.de
*/
#include <linux/init.h>
char visws_board_type = -1;
char visws_board_rev = -1;
......
......@@ -9,6 +9,7 @@
*/
#include <linux/vmalloc.h>
#include <linux/init.h>
#include <asm/io.h>
#include <asm/pgalloc.h>
#include <asm/fixmap.h>
......
#include <linux/pci.h>
#include <linux/acpi.h>
#include <linux/init.h>
#include "pci.h"
static int __init pci_acpi_init(void)
......
......@@ -7,6 +7,7 @@
#include <linux/sched.h>
#include <linux/pci.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <asm/segment.h>
#include <asm/io.h>
......
......@@ -3,6 +3,7 @@
*/
#include <linux/pci.h>
#include <linux/init.h>
#include "pci.h"
/*
......
......@@ -3,6 +3,7 @@
*/
#include <linux/pci.h>
#include <linux/init.h>
#include "pci.h"
......
/*
* legacy.c - traditional, old school PCI bus probing
*/
#include <linux/init.h>
#include <linux/pci.h>
#include "pci.h"
......
......@@ -2,6 +2,7 @@
* numa.c - Low-level PCI access for NUMA-Q machines
*/
#include <linux/pci.h>
#include <linux/init.h>
#include "pci.h"
......
......@@ -3,6 +3,7 @@
*/
#include <linux/pci.h>
#include <linux/init.h>
#include "pci.h"
......
......@@ -507,7 +507,6 @@ static char *rq_flags[] = {
"REQ_STARTED",
"REQ_DONTPREP",
"REQ_QUEUED",
"REQ_DRIVE_ACB",
"REQ_PC",
"REQ_BLOCK_PC",
"REQ_SENSE",
......
......@@ -281,7 +281,7 @@ static int ide_build_sglist(struct ata_device *drive, struct request *rq)
struct scatterlist *sg = ch->sg_table;
int nents;
if (rq->flags & REQ_DRIVE_ACB) {
if (rq->flags & REQ_SPECIAL) {
struct ata_taskfile *args = rq->special;
if (args->command_type == IDE_DRIVE_TASK_RAW_WRITE)
......@@ -391,7 +391,7 @@ static void icside_dma_enable(struct ata_device *drive, int on, int verbose)
udma_tcq_enable(drive, 0);
#endif
}
/*
* We don't need any bouncing. Yes, this looks the
* wrong way around, but it is correct.
......@@ -492,7 +492,7 @@ icside_dma_common(struct ata_device *drive, struct request *rq,
*/
BUG_ON(dma_channel_active(ch->hw.dma));
count = ch->sg_nents = ide_build_sglist(ch, rq);
count = ch->sg_nents = ide_build_sglist(drive, rq);
if (!count)
return 1;
......@@ -518,33 +518,6 @@ icside_dma_common(struct ata_device *drive, struct request *rq,
return 0;
}
static int icside_dma_read(struct ata_device *drive, struct request *rq)
{
struct ata_channel *ch = drive->channel;
unsigned int cmd;
if (icside_dma_common(drive, rq, DMA_MODE_READ))
return 1;
if (drive->type != ATA_DISK)
return 0;
ide_set_handler(drive, icside_dmaintr, WAIT_CMD, NULL);
if ((rq->flags & REQ_DRIVE_ACB) && drive->addressing == 1) {
struct ata_taskfile *args = rq->special;
cmd = args->taskfile.command;
} else if (drive->addressing) {
cmd = WIN_READDMA_EXT;
} else {
cmd = WIN_READDMA;
}
OUT_BYTE(cmd, IDE_COMMAND_REG);
enable_dma(ch->hw.dma);
return 0;
}
static int icside_dma_init(struct ata_device *drive, struct request *rq)
{
struct ata_channel *ch = drive->channel;
......@@ -558,13 +531,13 @@ static int icside_dma_init(struct ata_device *drive, struct request *rq)
ide_set_handler(drive, icside_dmaintr, WAIT_CMD, NULL);
if ((rq->flags & REQ_DRIVE_ACB) && drive->addressing == 1) {
if ((rq->flags & REQ_SPECIAL) && drive->addressing == 1) {
struct ata_taskfile *args = rq->special;
cmd = args->taskfile.command;
cmd = args->cmd;
} else if (drive->addressing) {
cmd = WIN_WRITEDMA_EXT;
cmd = rq_data_dir(rq) == WRITE ? WIN_WRITEDMA_EXT : WIN_READDMA_EXT;
} else {
cmd = WIN_WRITEDMA;
cmd = rq_data_dir(rq) == WRITE ? WIN_WRITEDMA : WIN_READDMA;
}
OUT_BYTE(cmd, IDE_COMMAND_REG);
......
......@@ -372,9 +372,8 @@ static u8 get_command(struct ata_device *drive, struct ata_taskfile *ar, int cmd
}
}
}
ar->handler = task_no_data_intr;
ar->command_type = IDE_DRIVE_TASK_NO_DATA;
/* not reached! */
return WIN_NOP;
}
......@@ -582,23 +581,21 @@ static int idedisk_open (struct inode *inode, struct file *filp, struct ata_devi
{
MOD_INC_USE_COUNT;
if (drive->removable && drive->usage == 1) {
struct ata_taskfile args;
check_disk_change(inode->i_rdev);
memset(&args, 0, sizeof(args));
args.cmd = WIN_DOORLOCK;
args.handler = task_no_data_intr;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
/*
* Ignore the return code from door_lock, since the open() has
* already succeeded once, and the door_lock is irrelevant at this
* time.
*/
if (drive->doorlocking) {
struct ata_taskfile args;
if (drive->doorlocking && ide_raw_taskfile(drive, &args))
drive->doorlocking = 0;
memset(&args, 0, sizeof(args));
args.cmd = WIN_DOORLOCK;
if (ide_raw_taskfile(drive, &args))
drive->doorlocking = 0;
}
}
return 0;
}
......@@ -613,29 +610,23 @@ static int idedisk_flushcache(struct ata_device *drive)
args.cmd = WIN_FLUSH_CACHE_EXT;
else
args.cmd = WIN_FLUSH_CACHE;
args.handler = task_no_data_intr;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
return ide_raw_taskfile(drive, &args);
}
static void idedisk_release(struct inode *inode, struct file *filp, struct ata_device *drive)
{
if (drive->removable && !drive->usage) {
struct ata_taskfile args;
/* XXX I don't think this is up to the lowlevel drivers.. --hch */
invalidate_bdev(inode->i_bdev, 0);
memset(&args, 0, sizeof(args));
args.cmd = WIN_DOORUNLOCK;
args.handler = task_no_data_intr;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
if (drive->doorlocking) {
struct ata_taskfile args;
if (drive->doorlocking &&
ide_raw_taskfile(drive, &args))
drive->doorlocking = 0;
memset(&args, 0, sizeof(args));
args.cmd = WIN_DOORUNLOCK;
if (ide_raw_taskfile(drive, &args))
drive->doorlocking = 0;
}
}
if ((drive->id->cfs_enable_2 & 0x3000) && drive->wcache)
if (idedisk_flushcache(drive))
......@@ -680,9 +671,6 @@ static int set_multcount(struct ata_device *drive, int arg)
memset(&args, 0, sizeof(args));
args.taskfile.sector_count = arg;
args.cmd = WIN_SETMULT;
args.handler = task_no_data_intr;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
if (!ide_raw_taskfile(drive, &args)) {
/* all went well track this setting as valid */
drive->mult_count = arg;
......@@ -712,9 +700,6 @@ static int write_cache(struct ata_device *drive, int arg)
memset(&args, 0, sizeof(args));
args.taskfile.feature = (arg) ? SETFEATURES_EN_WCACHE : SETFEATURES_DIS_WCACHE;
args.cmd = WIN_SETFEATURES;
args.handler = task_no_data_intr;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
ide_raw_taskfile(drive, &args);
drive->wcache = arg;
......@@ -728,9 +713,6 @@ static int idedisk_standby(struct ata_device *drive)
memset(&args, 0, sizeof(args));
args.cmd = WIN_STANDBYNOW1;
args.handler = task_no_data_intr;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
return ide_raw_taskfile(drive, &args);
}
......@@ -742,9 +724,6 @@ static int set_acoustic(struct ata_device *drive, int arg)
args.taskfile.feature = (arg)?SETFEATURES_EN_AAM:SETFEATURES_DIS_AAM;
args.taskfile.sector_count = arg;
args.cmd = WIN_SETFEATURES;
args.handler = task_no_data_intr;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
ide_raw_taskfile(drive, &args);
drive->acoustic = arg;
......@@ -864,9 +843,6 @@ static unsigned long native_max_address(struct ata_device *drive)
memset(&args, 0, sizeof(args));
args.taskfile.device_head = 0x40;
args.cmd = WIN_READ_NATIVE_MAX;
args.handler = task_no_data_intr;
/* submit command request */
ide_raw_taskfile(drive, &args);
/* if OK, compute maximum address value */
......@@ -892,9 +868,6 @@ static u64 native_max_address_ext(struct ata_device *drive)
args.taskfile.device_head = 0x40;
args.cmd = WIN_READ_NATIVE_MAX_EXT;
args.handler = task_no_data_intr;
/* submit command request */
ide_raw_taskfile(drive, &args);
/* if OK, compute maximum address value */
......@@ -933,9 +906,8 @@ static sector_t set_max_address(struct ata_device *drive, sector_t addr_req)
args.taskfile.device_head = ((addr_req >> 24) & 0x0f) | 0x40;
args.cmd = WIN_SET_MAX;
args.handler = task_no_data_intr;
/* submit command request */
ide_raw_taskfile(drive, &args);
/* if OK, read new maximum address value */
if (!(drive->status & ERR_STAT)) {
addr_set = ((args.taskfile.device_head & 0x0f) << 24)
......@@ -965,12 +937,10 @@ static u64 set_max_address_ext(struct ata_device *drive, u64 addr_req)
args.hobfile.sector_number = (addr_req >>= 8);
args.hobfile.low_cylinder = (addr_req >>= 8);
args.hobfile.high_cylinder = (addr_req >>= 8);
args.hobfile.device_head = 0x40;
args.handler = task_no_data_intr;
/* submit command request */
ide_raw_taskfile(drive, &args);
/* if OK, compute maximum address value */
if (!(drive->status & ERR_STAT)) {
u32 high = (args.hobfile.high_cylinder << 16) |
......
......@@ -308,8 +308,6 @@ typedef struct {
#define IDEFLOPPY_IOCTL_FORMAT_START 0x4602
#define IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS 0x4603
#define IDEFLOPPY_RQ (REQ_SPECIAL)
/*
* Error codes which are returned in rq->errors to the higher part
* of the driver.
......@@ -633,7 +631,7 @@ static int idefloppy_end_request(struct ata_device *drive, struct request *rq, i
if (!rq)
return 0;
if (!(rq->flags & IDEFLOPPY_RQ)) {
if (!(rq->flags & REQ_SPECIAL)) {
ide_end_request(drive, rq, uptodate);
return 0;
}
......@@ -717,7 +715,7 @@ static void idefloppy_queue_pc_head(struct ata_device *drive,
struct atapi_packet_command *pc, struct request *rq)
{
memset(rq, 0, sizeof(*rq));
rq->flags = IDEFLOPPY_RQ;
rq->flags = REQ_SPECIAL;
/* FIXME: --mdcki */
rq->buffer = (char *) pc;
(void) ide_do_drive_cmd (drive, rq, ide_preempt);
......@@ -1251,7 +1249,7 @@ static ide_startstop_t idefloppy_do_request(struct ata_device *drive, struct req
}
pc = idefloppy_next_pc_storage(drive);
idefloppy_create_rw_cmd (floppy, pc, rq, block);
} else if (rq->flags & IDEFLOPPY_RQ) {
} else if (rq->flags & REQ_SPECIAL) {
/* FIXME: --mdcki */
pc = (struct atapi_packet_command *) rq->buffer;
} else {
......@@ -1274,7 +1272,7 @@ static int idefloppy_queue_pc_tail(struct ata_device *drive, struct atapi_packet
memset(&rq, 0, sizeof(rq));
/* FIXME: --mdcki */
rq.buffer = (char *) pc;
rq.flags = IDEFLOPPY_RQ;
rq.flags = REQ_SPECIAL;
return ide_do_drive_cmd(drive, &rq, ide_wait);
}
......
......@@ -1126,7 +1126,7 @@ pmac_ide_build_dmatable(struct ata_device *drive, struct request *rq, int ix, in
udelay(1);
/* Build sglist */
if (rq->flags & REQ_DRIVE_ACB) {
if (rq->flags & REQ_SPECIAL) {
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);
......@@ -1437,10 +1437,11 @@ static int pmac_udma_init(struct ata_device *drive, struct request *rq)
if (drive->type != ATA_DISK)
return 0;
ide_set_handler(drive, ide_dma_intr, WAIT_CMD, NULL);
if ((rq->flags & REQ_DRIVE_ACB) &&
if ((rq->flags & REQ_SPECIAL) &&
(drive->addressing == 1)) {
struct ata_taskfile *args = rq->special;
OUT_BYTE(args->taskfile.command, IDE_COMMAND_REG);
/* FIXME: this is never reached */
OUT_BYTE(args->cmd, IDE_COMMAND_REG);
} else if (drive->addressing) {
OUT_BYTE(reading ? WIN_READDMA_EXT : WIN_WRITEDMA_EXT, IDE_COMMAND_REG);
} else {
......
......@@ -176,27 +176,6 @@ int drive_is_ready(struct ata_device *drive)
return 1; /* drive ready: *might* be interrupting */
}
/*
* Handler for commands without a data phase
*/
ide_startstop_t task_no_data_intr(struct ata_device *drive, struct request *rq)
{
struct ata_taskfile *ar = rq->special;
ide__sti(); /* local CPU only */
if (!ata_status(drive, READY_STAT, BAD_STAT)) {
/* Keep quiet for NOP because it is expected to fail. */
if (ar && ar->cmd != WIN_NOP)
return ata_error(drive, rq, __FUNCTION__);
}
if (ar)
ide_end_drive_cmd(drive, rq);
return ide_stopped;
}
ide_startstop_t ata_taskfile(struct ata_device *drive,
struct ata_taskfile *ar, struct request *rq)
{
......@@ -385,21 +364,72 @@ int ide_do_drive_cmd(struct ata_device *drive, struct request *rq, ide_action_t
}
int ide_raw_taskfile(struct ata_device *drive, struct ata_taskfile *args)
/*
* Invoked on completion of a special REQ_SPECIAL command.
*/
ide_startstop_t ata_special_intr(struct ata_device *drive, struct
request *rq) {
struct ata_taskfile *ar = rq->special;
ide_startstop_t ret = ide_stopped;
ide__sti(); /* local CPU only */
if (rq->buffer && ar->taskfile.sector_number) {
if (!ata_status(drive, 0, DRQ_STAT) && ar->taskfile.sector_number) {
int retries = 10;
ata_read(drive, rq->buffer, ar->taskfile.sector_number * SECTOR_WORDS);
while (!ata_status(drive, 0, BUSY_STAT) && retries--)
udelay(100);
}
}
if (!ata_status(drive, READY_STAT, BAD_STAT)) {
/* Keep quiet for NOP because it is expected to fail. */
if (ar->cmd != WIN_NOP)
ret = ata_error(drive, rq, __FUNCTION__);
rq->errors = 1;
}
ar->taskfile.feature = IN_BYTE(IDE_ERROR_REG);
ata_in_regfile(drive, &ar->taskfile);
ar->taskfile.device_head = IN_BYTE(IDE_SELECT_REG);
if ((drive->id->command_set_2 & 0x0400) &&
(drive->id->cfs_enable_2 & 0x0400) &&
(drive->addressing == 1)) {
/* The following command goes to the hob file! */
OUT_BYTE(0x80, drive->channel->io_ports[IDE_CONTROL_OFFSET]);
ar->hobfile.feature = IN_BYTE(IDE_FEATURE_REG);
ata_in_regfile(drive, &ar->hobfile);
}
blkdev_dequeue_request(rq);
drive->rq = NULL;
end_that_request_last(rq);
return ret;
}
int ide_raw_taskfile(struct ata_device *drive, struct ata_taskfile *ar)
{
struct request rq;
struct request req;
ar->command_type = IDE_DRIVE_TASK_NO_DATA;
ar->handler = ata_special_intr;
memset(&rq, 0, sizeof(rq));
rq.flags = REQ_DRIVE_ACB;
rq.special = args;
memset(&req, 0, sizeof(req));
req.flags = REQ_SPECIAL;
req.special = ar;
return ide_do_drive_cmd(drive, &rq, ide_wait);
return ide_do_drive_cmd(drive, &req, ide_wait);
}
EXPORT_SYMBOL(drive_is_ready);
EXPORT_SYMBOL(ide_do_drive_cmd);
EXPORT_SYMBOL(ata_read);
EXPORT_SYMBOL(ata_write);
EXPORT_SYMBOL(ata_taskfile);
EXPORT_SYMBOL(task_no_data_intr);
EXPORT_SYMBOL(ide_do_drive_cmd);
EXPORT_SYMBOL(ata_special_intr);
EXPORT_SYMBOL(ide_raw_taskfile);
......@@ -389,37 +389,6 @@ static inline u32 read_24(struct ata_device *drive)
IN_BYTE(IDE_SECTOR_REG);
}
/*
* Clean up after success/failure of an explicit drive cmd
*
* Should be called under lock held.
*/
void ide_end_drive_cmd(struct ata_device *drive, struct request *rq)
{
if (rq->flags & REQ_DRIVE_ACB) {
struct ata_taskfile *ar = rq->special;
rq->errors = !ata_status(drive, READY_STAT, BAD_STAT);
if (ar) {
ar->taskfile.feature = IN_BYTE(IDE_ERROR_REG);
ata_in_regfile(drive, &ar->taskfile);
ar->taskfile.device_head = IN_BYTE(IDE_SELECT_REG);
if ((drive->id->command_set_2 & 0x0400) &&
(drive->id->cfs_enable_2 & 0x0400) &&
(drive->addressing == 1)) {
/* The following command goes to the hob file! */
OUT_BYTE(0x80, drive->channel->io_ports[IDE_CONTROL_OFFSET]);
ar->hobfile.feature = IN_BYTE(IDE_FEATURE_REG);
ata_in_regfile(drive, &ar->hobfile);
}
}
}
blkdev_dequeue_request(rq);
drive->rq = NULL;
end_that_request_last(rq);
}
#if FANCY_STATUS_DUMPS
struct ata_bit_messages {
u8 mask;
......@@ -551,26 +520,12 @@ static void try_to_flush_leftover_data(struct ata_device *drive)
# define IS_PDC4030_DRIVE (0) /* auto-NULLs out pdc4030 code */
#endif
/*
* This is invoked on completion of a WIN_RESTORE (recalibrate) cmd.
*
* FIXME: Why can't be just use task_no_data_intr here?
*/
static ide_startstop_t recal_intr(struct ata_device *drive, struct request *rq)
{
if (!ata_status(drive, READY_STAT, BAD_STAT))
return ata_error(drive, rq, __FUNCTION__);
return ide_stopped;
}
/*
* We are still on the old request path here so issuing the recalibrate command
* directly should just work.
*/
static int do_recalibrate(struct ata_device *drive)
{
printk(KERN_INFO "%s: recalibrating!\n", drive->name);
if (drive->type != ATA_DISK)
return ide_stopped;
......@@ -578,12 +533,12 @@ static int do_recalibrate(struct ata_device *drive)
if (!IS_PDC4030_DRIVE) {
struct ata_taskfile args;
printk(KERN_INFO "%s: recalibrating...\n", drive->name);
memset(&args, 0, sizeof(args));
args.taskfile.sector_count = drive->sect;
args.cmd = WIN_RESTORE;
args.handler = recal_intr;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
ata_taskfile(drive, &args, NULL);
ide_raw_taskfile(drive, &args);
printk(KERN_INFO "%s: done!\n", drive->name);
}
return IS_PDC4030_DRIVE ? ide_stopped : ide_started;
......@@ -604,7 +559,6 @@ ide_startstop_t ata_error(struct ata_device *drive, struct request *rq, const ch
/* retry only "normal" I/O: */
if (!(rq->flags & REQ_CMD)) {
rq->errors = 1;
ide_end_drive_cmd(drive, rq);
return ide_stopped;
}
......@@ -633,6 +587,7 @@ ide_startstop_t ata_error(struct ata_device *drive, struct request *rq, const ch
OUT_BYTE(WIN_IDLEIMMEDIATE, IDE_COMMAND_REG); /* force an abort */
if (rq->errors >= ERROR_MAX) {
printk(KERN_ERR "%s: max number of retries exceeded!\n", drive->name);
if (ata_ops(drive) && ata_ops(drive)->end_request)
ata_ops(drive)->end_request(drive, rq, 0);
else
......@@ -729,10 +684,10 @@ static ide_startstop_t start_request(struct ata_device *drive, struct request *r
/* Strange disk manager remap.
*/
if ((rq->flags & REQ_CMD) &&
(drive->type == ATA_DISK || drive->type == ATA_FLOPPY)) {
block += drive->sect0;
}
if (rq->flags & REQ_CMD)
if (drive->type == ATA_DISK || drive->type == ATA_FLOPPY)
block += drive->sect0;
/* Yecch - this will shift the entire interval, possibly killing some
* innocent following sector.
......@@ -753,14 +708,8 @@ static ide_startstop_t start_request(struct ata_device *drive, struct request *r
/* This issues a special drive command.
*/
if (rq->flags & REQ_DRIVE_ACB) {
struct ata_taskfile *ar = rq->special;
if (!(ar))
goto args_error;
return ata_taskfile(drive, ar, NULL);
}
if (rq->flags & REQ_SPECIAL)
return ata_taskfile(drive, rq->special, NULL);
/* The normal way of execution is to pass and execute the request
* handler down to the device type driver.
......@@ -789,19 +738,6 @@ static ide_startstop_t start_request(struct ata_device *drive, struct request *r
ide_end_request(drive, rq, 0);
return ide_stopped;
args_error:
/* NULL as arguemnt is used by ioctls as a way of waiting for all
* current requests to be flushed from the queue.
*/
#ifdef DEBUG
printk("%s: DRIVE_CMD (null)\n", drive->name);
#endif
ide_end_drive_cmd(drive, rq);
return ide_stopped;
}
ide_startstop_t restart_request(struct ata_device *drive)
......@@ -1485,8 +1421,8 @@ EXPORT_SYMBOL(ata_dump);
EXPORT_SYMBOL(ata_error);
EXPORT_SYMBOL(ide_wait_stat);
/* FIXME: this is a trully bad name */
EXPORT_SYMBOL(restart_request);
EXPORT_SYMBOL(ide_end_drive_cmd);
EXPORT_SYMBOL(__ide_end_request);
EXPORT_SYMBOL(ide_end_request);
EXPORT_SYMBOL(ide_stall_queue);
......
......@@ -33,30 +33,6 @@
#include "ioctl.h"
/*
* Invoked on completion of a special DRIVE_CMD.
*/
static ide_startstop_t drive_cmd_intr(struct ata_device *drive, struct request *rq)
{
struct ata_taskfile *ar = rq->special;
ide__sti(); /* local CPU only */
if (!ata_status(drive, 0, DRQ_STAT) && ar->taskfile.sector_number) {
int retries = 10;
ata_read(drive, rq->buffer, ar->taskfile.sector_number * SECTOR_WORDS);
while (!ata_status(drive, 0, BUSY_STAT) && retries--)
udelay(100);
}
if (!ata_status(drive, READY_STAT, BAD_STAT))
return ata_error(drive, rq, __FUNCTION__); /* already calls ide_end_drive_cmd */
ide_end_drive_cmd(drive, rq);
return ide_stopped;
}
/*
* Implement generic ioctls invoked from userspace to imlpement specific
* functionality.
......@@ -79,7 +55,7 @@ static int do_cmd_ioctl(struct ata_device *drive, unsigned long arg)
return -EFAULT;
memset(&rq, 0, sizeof(rq));
rq.flags = REQ_DRIVE_ACB;
rq.flags = REQ_SPECIAL;
memset(&args, 0, sizeof(args));
......@@ -107,7 +83,7 @@ static int do_cmd_ioctl(struct ata_device *drive, unsigned long arg)
/* Issue ATA command and wait for completion.
*/
args.handler = drive_cmd_intr;
args.handler = ata_special_intr;
rq.buffer = argbuf + 4;
rq.special = &args;
......
......@@ -64,7 +64,7 @@ static int build_sglist(struct ata_device *drive, struct request *rq)
struct scatterlist *sg = ch->sg_table;
int nents = 0;
if (rq->flags & REQ_DRIVE_ACB) {
if (rq->flags & REQ_SPECIAL) {
struct ata_taskfile *args = rq->special;
#if 1
unsigned char *virt_addr = rq->buffer;
......@@ -525,6 +525,7 @@ int udma_pci_init(struct ata_device *drive, struct request *rq)
if (ata_start_dma(drive, rq))
return 1;
/* No DMA transfers on ATAPI devices. */
if (drive->type != ATA_DISK)
return 0;
......@@ -533,13 +534,8 @@ int udma_pci_init(struct ata_device *drive, struct request *rq)
else
cmd = 0x00;
ide_set_handler(drive, ide_dma_intr, WAIT_CMD, dma_timer_expiry); /* issue cmd to drive */
if ((rq->flags & REQ_DRIVE_ACB) && (drive->addressing == 1)) {
/* FIXME: this should never happen */
struct ata_taskfile *args = rq->special;
outb(args->cmd, IDE_COMMAND_REG);
} else if (drive->addressing)
ide_set_handler(drive, ide_dma_intr, WAIT_CMD, dma_timer_expiry);
if (drive->addressing)
outb(cmd ? WIN_READDMA_EXT : WIN_WRITEDMA_EXT, IDE_COMMAND_REG);
else
outb(cmd ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG);
......
......@@ -60,7 +60,9 @@ static ide_startstop_t tcq_nop_handler(struct ata_device *drive, struct request
struct ata_taskfile *args = rq->special;
ide__sti();
ide_end_drive_cmd(drive, rq);
blkdev_dequeue_request(rq);
drive->rq = NULL;
end_that_request_last(rq);
kfree(args);
return ide_stopped;
......@@ -402,18 +404,14 @@ static int check_autopoll(struct ata_device *drive)
if (drives <= 1)
return 0;
memset(&args, 0, sizeof(args));
args.taskfile.feature = 0x01;
args.cmd = WIN_NOP;
args.handler = task_no_data_intr;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
/*
* do taskfile and check ABRT bit -- intelligent adapters will not
* pass NOP with sub-code 0x01 to device, so the command will not
* fail there
*/
memset(&args, 0, sizeof(args));
args.taskfile.feature = 0x01;
args.cmd = WIN_NOP;
ide_raw_taskfile(drive, &args);
if (args.taskfile.feature & ABRT_ERR)
return 1;
......@@ -442,9 +440,6 @@ static int configure_tcq(struct ata_device *drive)
memset(&args, 0, sizeof(args));
args.taskfile.feature = SETFEATURES_EN_WCACHE;
args.cmd = WIN_SETFEATURES;
args.handler = task_no_data_intr;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
if (ide_raw_taskfile(drive, &args)) {
printk("%s: failed to enable write cache\n", drive->name);
return 1;
......@@ -457,9 +452,6 @@ static int configure_tcq(struct ata_device *drive)
memset(&args, 0, sizeof(args));
args.taskfile.feature = SETFEATURES_DIS_RI;
args.cmd = WIN_SETFEATURES;
args.handler = task_no_data_intr;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
if (ide_raw_taskfile(drive, &args)) {
printk("%s: disabling release interrupt fail\n", drive->name);
return 1;
......@@ -472,9 +464,6 @@ static int configure_tcq(struct ata_device *drive)
memset(&args, 0, sizeof(args));
args.taskfile.feature = SETFEATURES_EN_SI;
args.cmd = WIN_SETFEATURES;
args.handler = task_no_data_intr;
args.command_type = IDE_DRIVE_TASK_NO_DATA;
if (ide_raw_taskfile(drive, &args)) {
printk("%s: enabling service interrupt fail\n", drive->name);
return 1;
......
......@@ -300,11 +300,11 @@ static long do_fcntl(unsigned int fd, unsigned int cmd,
unlock_kernel();
break;
case F_GETLK:
err = fcntl_getlk(fd, (struct flock *) arg);
err = fcntl_getlk(filp, (struct flock *) arg);
break;
case F_SETLK:
case F_SETLKW:
err = fcntl_setlk(fd, cmd, (struct flock *) arg);
err = fcntl_setlk(filp, cmd, (struct flock *) arg);
break;
case F_GETOWN:
/*
......@@ -386,13 +386,11 @@ asmlinkage long sys_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg
switch (cmd) {
case F_GETLK64:
err = fcntl_getlk64(fd, (struct flock64 *) arg);
err = fcntl_getlk64(filp, (struct flock64 *) arg);
break;
case F_SETLK64:
err = fcntl_setlk64(fd, cmd, (struct flock64 *) arg);
break;
case F_SETLKW64:
err = fcntl_setlk64(fd, cmd, (struct flock64 *) arg);
err = fcntl_setlk64(filp, cmd, (struct flock64 *) arg);
break;
default:
err = do_fcntl(fd, cmd, arg, filp);
......
......@@ -390,8 +390,7 @@ void prune_icache(int goal)
if (atomic_read(&inode->i_count))
continue;
list_del(tmp);
list_del(&inode->i_hash);
INIT_LIST_HEAD(&inode->i_hash);
list_del_init(&inode->i_hash);
list_add(tmp, freeable);
inode->i_state |= I_FREEING;
count++;
......@@ -777,8 +776,7 @@ void __insert_inode_hash(struct inode *inode, unsigned long hashval)
void remove_inode_hash(struct inode *inode)
{
spin_lock(&inode_lock);
list_del(&inode->i_hash);
INIT_LIST_HEAD(&inode->i_hash);
list_del_init(&inode->i_hash);
spin_unlock(&inode_lock);
}
......@@ -786,10 +784,8 @@ void generic_delete_inode(struct inode *inode)
{
struct super_operations *op = inode->i_sb->s_op;
list_del(&inode->i_hash);
INIT_LIST_HEAD(&inode->i_hash);
list_del(&inode->i_list);
INIT_LIST_HEAD(&inode->i_list);
list_del_init(&inode->i_hash);
list_del_init(&inode->i_list);
inode->i_state|=I_FREEING;
inodes_stat.nr_inodes--;
spin_unlock(&inode_lock);
......
......@@ -397,10 +397,8 @@ locks_same_owner(struct file_lock *fl1, struct file_lock *fl2)
*/
static void locks_delete_block(struct file_lock *waiter)
{
list_del(&waiter->fl_block);
INIT_LIST_HEAD(&waiter->fl_block);
list_del(&waiter->fl_link);
INIT_LIST_HEAD(&waiter->fl_link);
list_del_init(&waiter->fl_block);
list_del_init(&waiter->fl_link);
waiter->fl_next = NULL;
}
......@@ -1353,9 +1351,8 @@ asmlinkage long sys_flock(unsigned int fd, unsigned int cmd)
/* Report the first existing lock that would conflict with l.
* This implements the F_GETLK command of fcntl().
*/
int fcntl_getlk(unsigned int fd, struct flock *l)
int fcntl_getlk(struct file *filp, struct flock *l)
{
struct file *filp;
struct file_lock *fl, file_lock;
struct flock flock;
int error;
......@@ -1367,19 +1364,14 @@ int fcntl_getlk(unsigned int fd, struct flock *l)
if ((flock.l_type != F_RDLCK) && (flock.l_type != F_WRLCK))
goto out;
error = -EBADF;
filp = fget(fd);
if (!filp)
goto out;
error = flock_to_posix_lock(filp, &file_lock, &flock);
if (error)
goto out_putf;
goto out;
if (filp->f_op && filp->f_op->lock) {
error = filp->f_op->lock(filp, F_GETLK, &file_lock);
if (error < 0)
goto out_putf;
goto out;
else if (error == LOCK_USE_CLNT)
/* Bypass for NFS with no locking - 2.0.36 compat */
fl = posix_test_lock(filp, &file_lock);
......@@ -1399,10 +1391,10 @@ int fcntl_getlk(unsigned int fd, struct flock *l)
*/
error = -EOVERFLOW;
if (fl->fl_start > OFFT_OFFSET_MAX)
goto out_putf;
goto out;
if ((fl->fl_end != OFFSET_MAX)
&& (fl->fl_end > OFFT_OFFSET_MAX))
goto out_putf;
goto out;
#endif
flock.l_start = fl->fl_start;
flock.l_len = fl->fl_end == OFFSET_MAX ? 0 :
......@@ -1414,8 +1406,6 @@ int fcntl_getlk(unsigned int fd, struct flock *l)
if (!copy_to_user(l, &flock, sizeof(flock)))
error = 0;
out_putf:
fput(filp);
out:
return error;
}
......@@ -1423,9 +1413,8 @@ int fcntl_getlk(unsigned int fd, struct flock *l)
/* Apply the lock described by l to an open file descriptor.
* This implements both the F_SETLK and F_SETLKW commands of fcntl().
*/
int fcntl_setlk(unsigned int fd, unsigned int cmd, struct flock *l)
int fcntl_setlk(struct file *filp, unsigned int cmd, struct flock *l)
{
struct file *filp;
struct file_lock *file_lock = locks_alloc_lock(0);
struct flock flock;
struct inode *inode;
......@@ -1443,13 +1432,6 @@ int fcntl_setlk(unsigned int fd, unsigned int cmd, struct flock *l)
/* Get arguments and validate them ...
*/
error = -EBADF;
filp = fget(fd);
if (!filp)
goto out;
error = -EINVAL;
inode = filp->f_dentry->d_inode;
/* Don't allow mandatory locks on files that may be memory mapped
......@@ -1461,23 +1443,23 @@ int fcntl_setlk(unsigned int fd, unsigned int cmd, struct flock *l)
if (!list_empty(&mapping->i_mmap_shared)) {
error = -EAGAIN;
goto out_putf;
goto out;
}
}
error = flock_to_posix_lock(filp, file_lock, &flock);
if (error)
goto out_putf;
goto out;
error = -EBADF;
switch (flock.l_type) {
case F_RDLCK:
if (!(filp->f_mode & FMODE_READ))
goto out_putf;
goto out;
break;
case F_WRLCK:
if (!(filp->f_mode & FMODE_WRITE))
goto out_putf;
goto out;
break;
case F_UNLCK:
break;
......@@ -1495,23 +1477,21 @@ int fcntl_setlk(unsigned int fd, unsigned int cmd, struct flock *l)
}
}
if (!(filp->f_mode & 3))
goto out_putf;
goto out;
break;
#endif
default:
error = -EINVAL;
goto out_putf;
goto out;
}
if (filp->f_op && filp->f_op->lock != NULL) {
error = filp->f_op->lock(filp, cmd, file_lock);
if (error < 0)
goto out_putf;
goto out;
}
error = posix_lock_file(filp, file_lock, cmd == F_SETLKW);
out_putf:
fput(filp);
out:
locks_free_lock(file_lock);
return error;
......@@ -1521,9 +1501,8 @@ int fcntl_setlk(unsigned int fd, unsigned int cmd, struct flock *l)
/* Report the first existing lock that would conflict with l.
* This implements the F_GETLK command of fcntl().
*/
int fcntl_getlk64(unsigned int fd, struct flock64 *l)
int fcntl_getlk64(struct file *filp, struct flock64 *l)
{
struct file *filp;
struct file_lock *fl, file_lock;
struct flock64 flock;
int error;
......@@ -1535,19 +1514,14 @@ int fcntl_getlk64(unsigned int fd, struct flock64 *l)
if ((flock.l_type != F_RDLCK) && (flock.l_type != F_WRLCK))
goto out;
error = -EBADF;
filp = fget(fd);
if (!filp)
goto out;
error = flock64_to_posix_lock(filp, &file_lock, &flock);
if (error)
goto out_putf;
goto out;
if (filp->f_op && filp->f_op->lock) {
error = filp->f_op->lock(filp, F_GETLK, &file_lock);
if (error < 0)
goto out_putf;
goto out;
else if (error == LOCK_USE_CLNT)
/* Bypass for NFS with no locking - 2.0.36 compat */
fl = posix_test_lock(filp, &file_lock);
......@@ -1570,8 +1544,6 @@ int fcntl_getlk64(unsigned int fd, struct flock64 *l)
if (!copy_to_user(l, &flock, sizeof(flock)))
error = 0;
out_putf:
fput(filp);
out:
return error;
}
......@@ -1579,9 +1551,8 @@ int fcntl_getlk64(unsigned int fd, struct flock64 *l)
/* Apply the lock described by l to an open file descriptor.
* This implements both the F_SETLK and F_SETLKW commands of fcntl().
*/
int fcntl_setlk64(unsigned int fd, unsigned int cmd, struct flock64 *l)
int fcntl_setlk64(struct file *filp, unsigned int cmd, struct flock64 *l)
{
struct file *filp;
struct file_lock *file_lock = locks_alloc_lock(0);
struct flock64 flock;
struct inode *inode;
......@@ -1599,13 +1570,6 @@ int fcntl_setlk64(unsigned int fd, unsigned int cmd, struct flock64 *l)
/* Get arguments and validate them ...
*/
error = -EBADF;
filp = fget(fd);
if (!filp)
goto out;
error = -EINVAL;
inode = filp->f_dentry->d_inode;
/* Don't allow mandatory locks on files that may be memory mapped
......@@ -1617,23 +1581,23 @@ int fcntl_setlk64(unsigned int fd, unsigned int cmd, struct flock64 *l)
if (!list_empty(&mapping->i_mmap_shared)) {
error = -EAGAIN;
goto out_putf;
goto out;
}
}
error = flock64_to_posix_lock(filp, file_lock, &flock);
if (error)
goto out_putf;
goto out;
error = -EBADF;
switch (flock.l_type) {
case F_RDLCK:
if (!(filp->f_mode & FMODE_READ))
goto out_putf;
goto out;
break;
case F_WRLCK:
if (!(filp->f_mode & FMODE_WRITE))
goto out_putf;
goto out;
break;
case F_UNLCK:
break;
......@@ -1641,18 +1605,16 @@ int fcntl_setlk64(unsigned int fd, unsigned int cmd, struct flock64 *l)
case F_EXLCK:
default:
error = -EINVAL;
goto out_putf;
goto out;
}
if (filp->f_op && filp->f_op->lock != NULL) {
error = filp->f_op->lock(filp, cmd, file_lock);
if (error < 0)
goto out_putf;
goto out;
}
error = posix_lock_file(filp, file_lock, cmd == F_SETLKW64);
out_putf:
fput(filp);
out:
locks_free_lock(file_lock);
return error;
......
......@@ -12,6 +12,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/kdev_t.h>
#include <linux/bio.h>
#include <linux/fs.h>
#include <linux/buffer_head.h>
......
......@@ -21,6 +21,7 @@
*/
#include <linux/config.h>
#include <linux/init.h>
#include <asm/processor.h>
#include <asm/i387.h>
#include <asm/msr.h>
......
......@@ -21,7 +21,6 @@
#ifdef __KERNEL__
#include <linux/config.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <asm/kmap_types.h>
#include <asm/tlbflush.h>
......@@ -33,7 +32,7 @@ extern pte_t *kmap_pte;
extern pgprot_t kmap_prot;
extern pte_t *pkmap_page_table;
extern void kmap_init(void) __init;
extern void kmap_init(void);
/*
* Right now we initialize only a single pte table. It can be extended
......
......@@ -3,7 +3,6 @@
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <asm/segment.h>
#include <linux/bitops.h> /* for LOCK_PREFIX */
......
......@@ -81,13 +81,11 @@ enum rq_flag_bits {
/*
* for ATA/ATAPI devices
*/
__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 (currently reset) */
__REQ_SPECIAL, /* driver suplied command */
__REQ_NR_BITS, /* stops here */
};
......@@ -100,7 +98,6 @@ enum rq_flag_bits {
#define REQ_STARTED (1 << __REQ_STARTED)
#define REQ_DONTPREP (1 << __REQ_DONTPREP)
#define REQ_QUEUED (1 << __REQ_QUEUED)
#define REQ_DRIVE_ACB (1 << __REQ_DRIVE_ACB)
#define REQ_PC (1 << __REQ_PC)
#define REQ_BLOCK_PC (1 << __REQ_BLOCK_PC)
#define REQ_SENSE (1 << __REQ_SENSE)
......
......@@ -576,11 +576,11 @@ extern struct list_head file_lock_list;
#include <linux/fcntl.h>
extern int fcntl_getlk(unsigned int, struct flock *);
extern int fcntl_setlk(unsigned int, unsigned int, struct flock *);
extern int fcntl_getlk(struct file *, struct flock *);
extern int fcntl_setlk(struct file *, unsigned int, struct flock *);
extern int fcntl_getlk64(unsigned int, struct flock64 *);
extern int fcntl_setlk64(unsigned int, unsigned int, struct flock64 *);
extern int fcntl_getlk64(struct file *, struct flock64 *);
extern int fcntl_setlk64(struct file *, unsigned int, struct flock64 *);
/* fs/locks.c */
extern void locks_init_lock(struct file_lock *);
......
......@@ -654,11 +654,6 @@ typedef enum {
extern int ide_do_drive_cmd(struct ata_device *, struct request *, ide_action_t);
/*
* Clean up after success/failure of an explicit drive cmd.
*/
extern void ide_end_drive_cmd(struct ata_device *, struct request *);
struct ata_taskfile {
struct hd_drive_task_hdr taskfile;
struct hd_drive_task_hdr hobfile;
......@@ -695,7 +690,7 @@ static inline void ide_unmap_rq(struct request *rq, char *to,
bio_kunmap_irq(to, flags);
}
extern ide_startstop_t task_no_data_intr(struct ata_device *, struct request *);
extern ide_startstop_t ata_special_intr(struct ata_device *, struct request *);
extern int ide_raw_taskfile(struct ata_device *, struct ata_taskfile *);
extern void ide_fix_driveid(struct hd_driveid *id);
......
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