Commit 938f5b72 authored by Martin Dalecki's avatar Martin Dalecki Committed by Linus Torvalds

[PATCH] 2.5.15 IDE 61

- Fix typo in pdc202xx driver.

- Fix locking order in ioctl.

- Fix wrong time_after usage introduced in 60. Maybe the fact I always get is
   wrong is related to the fact that I'm using the mouse with the left hand!?

- Apply arch-clean-2 by Bartlomiej Zolnierkiewicz.

- Don't disable interrupts during ide_wait_stat(). I see no reason too.

- Push flags down from hwgroup to the ata_chaannel structure.

- Apply small fixes from Franz Sirl to make AEC6280 working properly again.
parent 33f18d46
......@@ -1058,6 +1058,7 @@ static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct f
if (put_user(val, (unsigned long *) arg))
return -EFAULT;
return 0;
}
......@@ -1081,6 +1082,7 @@ static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct f
if (put_user(val, (unsigned long *) arg))
return -EFAULT;
return 0;
}
......@@ -1100,7 +1102,7 @@ static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct f
}
case HDIO_GET_ACOUSTIC: {
u8 val = drive->acoustic;
unsigned long val = drive->acoustic;
if (put_user(val, (u8 *) arg))
return -EFAULT;
......@@ -1128,6 +1130,7 @@ static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct f
if (put_user(val, (u8 *) arg))
return -EFAULT;
return 0;
}
......@@ -1153,7 +1156,7 @@ static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct f
/*
* IDE subdriver functions, registered with ide.c
* Subdriver functions.
*/
static struct ata_operations idedisk_driver = {
owner: THIS_MODULE,
......@@ -1178,11 +1181,9 @@ static void __exit idedisk_exit (void)
while ((drive = ide_scan_devices(ATA_DISK, "ide-disk", &idedisk_driver, failed)) != NULL) {
if (idedisk_cleanup (drive)) {
printk (KERN_ERR "%s: cleanup_module() called while still busy\n", drive->name);
failed++;
printk(KERN_ERR "%s: cleanup_module() called while still busy\n", drive->name);
++failed;
}
/* We must remove proc entries defined in this module.
Otherwise we oops while accessing these entries */
}
}
......@@ -1203,10 +1204,11 @@ int idedisk_init(void)
idedisk_cleanup(drive);
continue;
}
failed--;
--failed;
}
revalidate_drives();
MOD_DEC_USE_COUNT;
return 0;
}
......
......@@ -382,10 +382,10 @@ static int dma_timer_expiry(struct ata_device *drive, struct request *rq)
#ifdef DEBUG
printk("%s: dma_timer_expiry: dma status == 0x%02x\n", drive->name, dma_stat);
#endif /* DEBUG */
#endif
#if 0
HWGROUP(drive)->expiry = NULL; /* one free ride for now */
drive->expiry = NULL; /* one free ride for now */
#endif
if (dma_stat & 2) { /* ERROR */
......
......@@ -122,7 +122,7 @@ static struct ata_channel __init *lookup_channel(unsigned long io_base, int boot
* Unless there is a bootable card that does not use the standard
* ports 1f0/170 (the ide0/ide1 defaults). The (bootable) flag.
*/
if (bootable) {
if (bootable == ON_BOARD) {
for (h = 0; h < MAX_HWIFS; ++h) {
hwif = &ide_hwifs[h];
if (hwif->chipset == ide_unknown)
......@@ -703,7 +703,7 @@ static void __init scan_pcidev(struct pci_dev *dev)
hpt374_device_order_fixup(dev, d);
} else if (d->vendor == PCI_VENDOR_ID_PROMISE && d->device == PCI_DEVICE_ID_PROMISE_20268R)
pdc20270_device_order_fixup(dev, d);
else if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
else {
printk(KERN_INFO "ATA: %s (%04x:%04x) on PCI slot %s\n",
dev->name, vendor, device, dev->slot_name);
setup_pci_device(dev, d);
......
......@@ -279,6 +279,7 @@ int drive_is_ready(struct ata_device *drive)
if (stat & BUSY_STAT)
return 0; /* drive busy: definitely not interrupting */
return 1; /* drive ready: *might* be interrupting */
}
......
This diff is collapsed.
......@@ -1450,7 +1450,7 @@ static struct ata_pci_device chipsets[] __initdata = {
init_chipset: pdc202xx_init_chipset,
ata66_check: ata66_pdc202xx,
init_channel: ide_init_pdc202xx,
exnablebits: {{0x50,0x02,0x02}, {0x50,0x04,0x04}},
enablebits: {{0x50,0x02,0x02}, {0x50,0x04,0x04}},
bootable: OFF_BOARD,
extra: 48,
flags: ATA_F_IRQ | ATA_F_DMA
......
......@@ -76,7 +76,7 @@ static void config_for_pio(ide_drive_t *drive, int pio, int report)
if (ide_config_drive_speed(drive, xfer_mode) == 0)
drv_ctrl = get_timing_sl82c105(t);
if (drive->using_dma == 0) {
if (!drive->using_dma) {
/*
* If we are actually using MW DMA, then we can not
* reprogram the interface drive control register.
......
......@@ -95,15 +95,15 @@ static void tcq_invalidate_queue(struct ata_device *drive)
del_timer(&ch->timer);
if (test_bit(IDE_DMA, &hwgroup->flags))
if (test_bit(IDE_DMA, &ch->active))
udma_stop(drive);
blk_queue_invalidate_tags(q);
drive->using_tcq = 0;
drive->queue_depth = 1;
clear_bit(IDE_BUSY, &hwgroup->flags);
clear_bit(IDE_DMA, &hwgroup->flags);
clear_bit(IDE_BUSY, &ch->active);
clear_bit(IDE_DMA, &ch->active);
hwgroup->handler = NULL;
/*
......@@ -152,6 +152,7 @@ static void tcq_invalidate_queue(struct ata_device *drive)
static void ata_tcq_irq_timeout(unsigned long data)
{
struct ata_device *drive = (struct ata_device *) data;
struct ata_channel *ch = drive->channel;
ide_hwgroup_t *hwgroup = HWGROUP(drive);
unsigned long flags;
......@@ -159,7 +160,7 @@ static void ata_tcq_irq_timeout(unsigned long data)
spin_lock_irqsave(&ide_lock, flags);
if (test_and_set_bit(IDE_BUSY, &hwgroup->flags))
if (test_and_set_bit(IDE_BUSY, &ch->active))
printk(KERN_ERR "ATA: %s: hwgroup not busy\n", __FUNCTION__);
if (hwgroup->handler == NULL)
printk(KERN_ERR "ATA: %s: missing isr!\n", __FUNCTION__);
......@@ -170,7 +171,7 @@ static void ata_tcq_irq_timeout(unsigned long data)
* if pending commands, try service before giving up
*/
if (ata_pending_commands(drive) && (GET_STAT() & SERVICE_STAT))
if (service(drive, hwgroup->rq) == ide_started)
if (service(drive, drive->rq) == ide_started)
return;
if (drive)
......@@ -241,7 +242,7 @@ static ide_startstop_t service(struct ata_device *drive, struct request *rq)
* Could be called with IDE_DMA in-progress from invalidate
* handler, refuse to do anything.
*/
if (test_bit(IDE_DMA, &HWGROUP(drive)->flags))
if (test_bit(IDE_DMA, &drive->channel->active))
return ide_stopped;
/*
......@@ -283,7 +284,7 @@ static ide_startstop_t service(struct ata_device *drive, struct request *rq)
* should not happen, a buggy device could introduce loop
*/
if ((feat = GET_FEAT()) & NSEC_REL) {
HWGROUP(drive)->rq = NULL;
drive->rq = NULL;
printk("%s: release in service\n", drive->name);
return ide_stopped;
}
......@@ -298,7 +299,7 @@ static ide_startstop_t service(struct ata_device *drive, struct request *rq)
return ide_stopped;
}
HWGROUP(drive)->rq = rq;
drive->rq = rq;
/*
* we'll start a dma read or write, device will trigger
......@@ -529,7 +530,7 @@ static ide_startstop_t udma_tcq_start(struct ata_device *drive, struct request *
struct ata_channel *ch = drive->channel;
TCQ_PRINTK("%s: setting up queued %d\n", __FUNCTION__, rq->tag);
if (!test_bit(IDE_BUSY, &ch->hwgroup->flags))
if (!test_bit(IDE_BUSY, &ch->active))
printk("queued_rw: IDE_BUSY not set\n");
if (tcq_wait_dataphase(drive))
......@@ -584,7 +585,7 @@ ide_startstop_t udma_tcq_taskfile(struct ata_device *drive, struct request *rq)
*/
if ((feat = GET_FEAT()) & NSEC_REL) {
drive->immed_rel++;
HWGROUP(drive)->rq = NULL;
drive->rq = NULL;
set_irq(drive, ide_dmaq_intr);
TCQ_PRINTK("REL in queued_start\n");
......
......@@ -82,10 +82,6 @@ static __inline__ void ide_init_default_hwifs(void)
#endif
}
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */
#endif /* __ASMalpha_IDE_H */
......@@ -21,10 +21,6 @@
#include <asm/arch/ide.h>
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
/*
* We always use the new IDE port registering,
* so these are fixed here.
......
......@@ -96,10 +96,6 @@ static __inline__ void ide_init_default_hwifs(void)
#undef SUPPORT_SLOW_DATA_PORTS
#define SUPPORT_SLOW_DATA_PORTS 0
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
/* the drive addressing is done through a controller register on the Etrax CPU */
void OUT_BYTE(unsigned char data, ide_ioreg_t reg);
unsigned char IN_BYTE(ide_ioreg_t reg);
......
......@@ -86,10 +86,6 @@ static __inline__ void ide_init_default_hwifs(void)
#endif
}
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */
#endif /* __ASMi386_IDE_H */
......@@ -92,10 +92,6 @@ ide_init_default_hwifs (void)
#endif
}
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */
#endif /* __ASM_IA64_IDE_H */
......@@ -145,10 +145,13 @@ static __inline__ void ide_init_default_hwifs(void)
#endif /* CONFIG_ATARI || CONFIG_Q40 */
#define ATA_ARCH_ACK_INTR
#ifdef CONFIG_ATARI
#define ATA_ARCH_LOCK
static __inline__ void ide_release_lock (int *ide_lock)
{
#ifdef CONFIG_ATARI
if (MACH_IS_ATARI) {
if (*ide_lock == 0) {
printk("ide_release_lock: bug\n");
......@@ -157,12 +160,10 @@ static __inline__ void ide_release_lock (int *ide_lock)
*ide_lock = 0;
stdma_release();
}
#endif /* CONFIG_ATARI */
}
static __inline__ void ide_get_lock (int *ide_lock, void (*handler)(int, void *, struct pt_regs *), void *data)
{
#ifdef CONFIG_ATARI
if (MACH_IS_ATARI) {
if (*ide_lock == 0) {
if (in_interrupt() > 0)
......@@ -171,10 +172,8 @@ static __inline__ void ide_get_lock (int *ide_lock, void (*handler)(int, void *,
*ide_lock = 1;
}
}
#endif /* CONFIG_ATARI */
}
#define ide_ack_intr(hwif) ((hwif)->hw.ack_intr ? (hwif)->hw.ack_intr(hwif) : 1)
#endif /* CONFIG_ATARI */
/*
* On the Atari, we sometimes can't enable interrupts:
......
......@@ -68,10 +68,6 @@ static __inline__ void ide_init_default_hwifs(void)
#undef SUPPORT_VLB_SYNC
#define SUPPORT_VLB_SYNC 0
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */
#endif /* __ASM_IDE_H */
......@@ -68,10 +68,6 @@ static __inline__ void ide_init_default_hwifs(void)
#endif
}
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */
#endif /* __ASM_IDE_H */
......@@ -81,10 +81,6 @@ static __inline__ void ide_init_default_hwifs(void)
#endif
}
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */
#endif /* __ASMi386_IDE_H */
......@@ -108,12 +108,8 @@ static __inline__ void ide_init_default_hwifs(void)
}
#if (defined CONFIG_APUS || defined CONFIG_BLK_DEV_MPC8xx_IDE )
#define ide_ack_intr(hwif) (hwif->hw.ack_intr ? hwif->hw.ack_intr(hwif) : 1)
#else
#define ide_ack_intr(hwif) (1)
#define ATA_ARCH_ACK_INTR
#endif
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */
......
......@@ -50,10 +50,6 @@ static __inline__ void ide_init_default_hwifs(void)
{
}
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */
#endif /* __ASMPPC64_IDE_H */
......@@ -17,14 +17,6 @@
#define ide__sti() do {} while (0)
/*
* The following are not needed for the non-m68k ports
*/
#define ide_ack_intr(hwif) (1)
#define ide_fix_driveid(id) do {} while (0)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
/*
* We always use the new IDE port registering,
* so these are fixed here.
......
......@@ -17,10 +17,6 @@
#define ide__sti() do {} while (0)
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
/*
* We always use the new IDE port registering,
* so these are fixed here.
......
......@@ -107,10 +107,6 @@ static __inline__ void ide_init_default_hwifs(void)
#endif
}
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */
#endif /* __ASM_SH_IDE_H */
......@@ -165,11 +165,6 @@ static __inline__ void ide_outsw(unsigned long port,
/* __flush_dcache_range((unsigned long)src, end); */ /* P3 see hme */
}
#define ide_ack_intr(hwif) (1)
/* #define ide_ack_intr(hwif) ((hwif)->hw.ack_intr ? (hwif)->hw.ack_intr(hwif) : 1) */
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */
#endif /* _SPARC_IDE_H */
......@@ -181,10 +181,6 @@ static __inline__ void ide_outsw(unsigned long port,
#endif
}
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */
#endif /* _SPARC64_IDE_H */
......@@ -86,10 +86,6 @@ static __inline__ void ide_init_default_hwifs(void)
#endif
}
#define ide_ack_intr(hwif) (1)
#define ide_release_lock(lock) do {} while (0)
#define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif /* __KERNEL__ */
#endif /* __ASMi386_IDE_H */
......@@ -239,6 +239,19 @@ void ide_setup_ports(hw_regs_t *hw,
#include <asm/ide.h>
/* Currently only m68k, apus and m8xx need it */
#ifdef ATA_ARCH_ACK_INTR
# define ide_ack_intr(hwif) (hwif->hw.ack_intr ? hwif->hw.ack_intr(hwif) : 1)
#else
# define ide_ack_intr(hwif) (1)
#endif
/* Currently only Atari needs it */
#ifndef ATA_ARCH_LOCK
# define ide_release_lock(lock) do {} while (0)
# define ide_get_lock(lock, hdlr, data) do {} while (0)
#endif
/*
* If the arch-dependant ide.h did not declare/define any OUT_BYTE or IN_BYTE
* functions, we make some defaults here. The only architecture currently
......@@ -324,14 +337,16 @@ struct ata_device {
* magically just go away.
*/
request_queue_t queue; /* per device request queue */
struct request *rq; /* current request */
unsigned long sleep; /* sleep until this time */
byte using_dma; /* disk is using dma for read/write */
byte using_tcq; /* disk is using queueing */
byte retry_pio; /* retrying dma capable host in pio */
byte state; /* retry state */
byte dsc_overlap; /* flag: DSC overlap */
unsigned using_dma : 1; /* disk is using dma for read/write */
unsigned using_tcq : 1; /* disk is using queueing */
unsigned dsc_overlap : 1; /* flag: DSC overlap */
unsigned waiting_for_dma: 1; /* dma currently in progress */
unsigned busy : 1; /* currently doing revalidate_disk() */
......@@ -403,11 +418,39 @@ struct ata_device {
int max_depth;
} ide_drive_t;
/*
* Status returned by various functions.
*/
typedef enum {
ide_stopped, /* no drive operation was started */
ide_started, /* a drive operation was started, and a handler was set */
ide_released /* started and released bus */
} ide_startstop_t;
/*
* Interrupt and timeout handler type.
*/
typedef ide_startstop_t (ata_handler_t)(struct ata_device *, struct request *);
typedef int (ata_expiry_t)(struct ata_device *, struct request *);
enum {
ATA_PRIMARY = 0,
ATA_SECONDARY = 1
};
enum {
IDE_BUSY, /* awaiting an interrupt */
IDE_SLEEP,
IDE_DMA /* DMA in progress */
};
typedef struct hwgroup_s {
/* FIXME: We should look for busy request queues instead of looking at
* the !NULL state of this field.
*/
ide_startstop_t (*handler)(struct ata_device *, struct request *); /* irq handler, if active */
} ide_hwgroup_t;
struct ata_channel {
struct device dev; /* device handle */
int unit; /* channel number */
......@@ -415,7 +458,9 @@ struct ata_channel {
struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */
struct timer_list timer; /* failsafe timer */
int (*expiry)(struct ata_device *, struct request *); /* irq handler, if active */
unsigned long poll_timeout; /* timeout value during polled operations */
struct ata_device *drive; /* last serviced drive */
unsigned long active; /* active processing request */
ide_ioreg_t io_ports[IDE_NR_PORTS]; /* task file registers */
hw_regs_t hw; /* Hardware info */
......@@ -506,9 +551,8 @@ struct ata_channel {
#endif
/* driver soft-power interface */
int (*busproc)(struct ata_device *, int);
byte bus_state; /* power state of the IDE bus */
unsigned long poll_timeout; /* timeout value during polled operations */
byte bus_state; /* power state of the IDE bus */
};
/*
......@@ -517,27 +561,8 @@ struct ata_channel {
extern int ide_register_hw(hw_regs_t *hw, struct ata_channel **hwifp);
extern void ide_unregister(struct ata_channel *hwif);
/*
* Status returned by various functions.
*/
typedef enum {
ide_stopped, /* no drive operation was started */
ide_started, /* a drive operation was started, and a handler was set */
ide_released /* started and released bus */
} ide_startstop_t;
/*
* Interrupt and timeout handler type.
*/
typedef ide_startstop_t (ata_handler_t)(struct ata_device *, struct request *);
typedef int (ata_expiry_t)(struct ata_device *, struct request *);
struct ata_taskfile;
#define IDE_BUSY 0 /* awaiting an interrupt */
#define IDE_SLEEP 1
#define IDE_DMA 2 /* DMA in progress */
#define IDE_MAX_TAG 32
#ifdef CONFIG_BLK_DEV_IDE_TCQ
......@@ -561,15 +586,6 @@ static inline int ata_can_queue(struct ata_device *drive)
# define ata_can_queue(drive) (1)
#endif
typedef struct hwgroup_s {
/* FIXME: We should look for busy request queues instead of looking at
* the !NULL state of this field.
*/
ide_startstop_t (*handler)(struct ata_device *, struct request *); /* irq handler, if active */
unsigned long flags; /* BUSY, SLEEPING */
struct request *rq; /* current request */
} ide_hwgroup_t;
/* FIXME: kill this as soon as possible */
#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0;
......
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