*/
static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block)
{
+ if (drive->blocked)
+ panic("ide: Request while drive blocked? You don't like your data intact?");
if (!(rq->flags & REQ_CMD)) {
blk_dump_rq_flags(rq, "do_rw_disk, bad command");
ide_end_request(drive, 0);
ide_add_setting(drive, "max_failures", SETTING_RW, -1, -1, TYPE_INT, 0, 65535, 1, 1, &drive->max_failures, NULL);
}
+static int idedisk_suspend(struct device *dev, u32 state, u32 level)
+{
+ int i;
+ ide_drive_t *drive = dev->driver_data;
+
+ printk("ide_disk_suspend()\n");
+ while (HWGROUP(drive)->handler)
+ schedule();
+ drive->blocked = 1;
+}
+
+static int idedisk_resume(struct device *dev, u32 level)
+{
+ ide_drive_t *drive = dev->driver_data;
+ if (!drive->blocked)
+ panic("ide: Resume but not suspended?\n");
+ drive->blocked = 0;
+}
+
+
/* This is just a hook for the overall driver tree.
*
* FIXME: This is soon goig to replace the custom linked list games played up
* to great extend between the different components of the IDE drivers.
*/
-static struct device_driver idedisk_devdrv = {};
+static struct device_driver idedisk_devdrv = {
+ suspend: idedisk_suspend,
+ resume: idedisk_resume,
+};
static void idedisk_setup(ide_drive_t *drive)
{
sprintf(drive->device.name, "ide-disk");
drive->device.driver = &idedisk_devdrv;
drive->device.parent = &HWIF(drive)->device;
+ drive->device.driver_data = drive;
device_register(&drive->device);
}
*/
#define ATA_PCI_IGNORE ((void *)-1)
+#define IDE_NO_DRIVER ((void *)-2)
#ifdef CONFIG_BLK_DEV_AEC62XX
extern unsigned int pci_init_aec62xx(struct pci_dev *);
{PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886A, NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0, ATA_F_FIXIRQ },
{PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886BF, NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0, ATA_F_FIXIRQ },
{PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C561, NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0, ATA_F_NOADMA },
- {PCI_VENDOR_ID_TTI, PCI_DEVICE_ID_TTI_HPT366, NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, OFF_BOARD, 240, ATA_F_IRQ | ATA_F_HPTHACK },
+ {PCI_VENDOR_ID_TTI, PCI_DEVICE_ID_TTI_HPT366, NULL, NULL, IDE_NO_DRIVER, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, OFF_BOARD, 240, ATA_F_IRQ | ATA_F_HPTHACK },
{0, 0, NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0 }};
/*
autodma = 1;
#endif
+ if (d->init_hwif == IDE_NO_DRIVER) {
+ printk(KERN_WARNING "%s: detected chipset, but driver not compiled in!\n", dev->name);
+ d->init_hwif = NULL;
+ }
+
if (pci_enable_device(dev)) {
printk(KERN_WARNING "%s: Could not enable PCI device.\n", dev->name);
return;
}
}
-void __init ide_scan_pcibus (int scan_direction)
+void __init ide_scan_pcibus(int scan_direction)
{
struct pci_dev *dev;
if (!scan_direction) {
- pci_for_each_dev(dev)
+ pci_for_each_dev(dev) {
scan_pcidev(dev);
+ }
} else {
- pci_for_each_dev_reverse(dev)
+ pci_for_each_dev_reverse(dev) {
scan_pcidev(dev);
+ }
}
}
static void ide_init_queue(ide_drive_t *drive)
{
request_queue_t *q = &drive->queue;
- int max_sectors;
+ int max_sectors = 255;
q->queuedata = HWGROUP(drive);
blk_init_queue(q, do_ide_request, &ide_lock);
#ifdef CONFIG_BLK_DEV_PDC4030
if (HWIF(drive)->chipset == ide_pdc4030)
max_sectors = 127;
- else
-#else
- max_sectors = 255;
#endif
blk_queue_max_sectors(q, max_sectors);
extern void pnpide_init(int);
#endif
+#ifdef CONFIG_BLK_DEV_IDE_MODES
/*
* Constant tables for PIO mode programming:
*/
{ "QUANTUM FIREBALL_1280", 3 },
{ NULL, 0 }
};
+#endif
/* default maximum number of failures */
#define IDE_DEFAULT_MAX_FAILURES 1
*/
ide_hwif_t ide_hwifs[MAX_HWIFS]; /* master data repository */
-
+#ifdef CONFIG_BLK_DEV_IDE_MODES
/*
* This routine searches the ide_pio_blacklist for an entry
* matching the start/whole of the supplied model name.
}
return -1;
}
+#endif
/*
* This routine returns the recommended PIO settings for a given drive,
/*
* Do not even *think* about calling this!
*/
-static void init_hwif_data(ide_hwif_t *hwif, int index)
+static void init_hwif_data(ide_hwif_t *hwif, unsigned int index)
{
static const byte ide_major[] = {
IDE0_MAJOR, IDE1_MAJOR, IDE2_MAJOR, IDE3_MAJOR, IDE4_MAJOR,
* get_info_ptr() returns the (ide_drive_t *) for a given device number.
* It returns NULL if the given device number does not match any present drives.
*/
-ide_drive_t *get_info_ptr (kdev_t i_rdev)
+ide_drive_t *get_info_ptr(kdev_t i_rdev)
{
unsigned int major = major(i_rdev);
int h;
unsigned int p, minor;
ide_hwif_t old_hwif;
- save_flags(flags); /* all CPUs */
- cli(); /* all CPUs */
+ spin_lock_irqsave(&ide_lock, flags);
if (!hwif->present)
goto abort;
put_device(&hwif->device);
/*
* All clear? Then blow away the buffer cache
*/
- spin_lock_irqsave(&ide_lock, flags);
+ spin_unlock_irqrestore(&ide_lock, flags);
for (unit = 0; unit < MAX_DRIVES; ++unit) {
drive = &hwif->drives[unit];
if (!drive->present)
invalidate_device(devp, 0);
}
}
-
}
-
#ifdef CONFIG_PROC_FS
destroy_proc_ide_drives(hwif);
#endif
- spin_unlock_irqrestore(&ide_lock, flags);
+ spin_lock_irqsave(&ide_lock, flags);
hwgroup = hwif->hwgroup;
/*
#endif
hwif->straight8 = old_hwif.straight8;
abort:
- restore_flags(flags); /* all CPUs */
+ spin_unlock_irqrestore(&ide_lock, flags);
}
/*
*/
int ide_register_hw(hw_regs_t *hw, ide_hwif_t **hwifp)
{
- int index, retry = 1;
+ int h, retry = 1;
ide_hwif_t *hwif;
do {
- for (index = 0; index < MAX_HWIFS; ++index) {
- hwif = &ide_hwifs[index];
+ for (h = 0; h < MAX_HWIFS; ++h) {
+ hwif = &ide_hwifs[h];
if (hwif->hw.io_ports[IDE_DATA_OFFSET] == hw->io_ports[IDE_DATA_OFFSET])
goto found;
}
- for (index = 0; index < MAX_HWIFS; ++index) {
- hwif = &ide_hwifs[index];
+ for (h = 0; h < MAX_HWIFS; ++h) {
+ hwif = &ide_hwifs[h];
if ((!hwif->present && !hwif->mate && !initializing) ||
(!hwif->hw.io_ports[IDE_DATA_OFFSET] && initializing))
goto found;
}
- for (index = 0; index < MAX_HWIFS; index++)
- ide_unregister(&ide_hwifs[index]);
+ for (h = 0; h < MAX_HWIFS; ++h)
+ ide_unregister(&ide_hwifs[h]);
} while (retry--);
return -1;
found:
if (hwifp)
*hwifp = hwif;
- return (initializing || hwif->present) ? index : -1;
+ return (initializing || hwif->present) ? h : -1;
}
/*
EXPORT_SYMBOL(ide_lock);
EXPORT_SYMBOL(drive_is_flashcard);
+EXPORT_SYMBOL(ide_timer_expiry);
EXPORT_SYMBOL(ide_intr);
EXPORT_SYMBOL(ide_get_queue);
EXPORT_SYMBOL(ide_add_generic_settings);
pnpide_init(1);
#endif
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULES)
+#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
# if defined(__mc68000__) || defined(CONFIG_APUS)
if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) {
ide_get_lock(&ide_intr_lock, NULL, NULL);/* for atari only */
/*
- * $Id: via82cxxx.c,v 3.33 2001/12/23 22:46:12 vojtech Exp $
+ * $Id: via82cxxx.c,v 3.34 2002/02/12 11:26:11 vojtech Exp $
*
* Copyright (c) 2000-2001 Vojtech Pavlik
*
via_print("----------VIA BusMastering IDE Configuration----------------");
- via_print("Driver Version: 3.33");
+ via_print("Driver Version: 3.34");
via_print("South Bridge: VIA %s", via_config->name);
pci_read_config_byte(isa_dev, PCI_REVISION_ID, &t);
if (via_clock < 20000 || via_clock > 50000) {
printk(KERN_WARNING "VP_IDE: User given PCI clock speed impossible (%d), using 33 MHz instead.\n", via_clock);
printk(KERN_WARNING "VP_IDE: Use ide0=ata66 if you want to assume 80-wire cable.\n");
- via_clock = 33;
+ via_clock = 33333;
}
/*
if (!test_bit(PC_WRITING, &pc->flags) && pc->actually_transferred && pc->actually_transferred <= 1024 && pc->buffer) {
printk(", rst = ");
scsi_buf = pc->scsi_cmd->request_buffer;
- hexdump(scsi_buf, min(16, pc->scsi_cmd->request_bufflen));
+ hexdump(scsi_buf, min(16U, pc->scsi_cmd->request_bufflen));
} else printk("\n");
}
}
static inline unsigned long get_timeout(idescsi_pc_t *pc)
{
- return max(WAIT_CMD, pc->timeout - jiffies);
+ return max((unsigned long) WAIT_CMD, pc->timeout - jiffies);
}
/*
/*
* idescsi_init will register the driver for each scsi.
*/
-static int idescsi_init(void)
+int idescsi_init(void)
{
ide_drive_t *drive;
idescsi_scsi_t *scsi;
hwif_chipset_t chipset;
} hw_regs_t;
-/*
- * Register new hardware with ide
- */
-extern int ide_register_hw(hw_regs_t *hw, struct hwif_s **hwifp);
/*
* Set up hw_regs_t structure before calling ide_register_hw (optional)
*/
unsigned autotune : 2; /* 1=autotune, 2=noautotune, 0=default */
unsigned remap_0_to_1 : 2; /* 0=remap if ezdrive, 1=remap, 2=noremap */
unsigned ata_flash : 1; /* 1=present, 0=default */
+ unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */
unsigned addressing; /* : 2; 0=28-bit, 1=48-bit, 2=64-bit */
byte scsi; /* 0=default, 1=skip current ide-subdriver for ide-scsi emulation */
select_t select; /* basic drive/head select reg value */
struct device device; /* global device tree handle */
} ide_hwif_t;
+/*
+ * Register new hardware with ide
+ */
+extern int ide_register_hw(hw_regs_t *hw, struct hwif_s **hwifp);
extern void ide_unregister(ide_hwif_t *hwif);
/*