You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (61 commits) ide: sanitize handling of IDE_HFLAG_NO_SET_MODE host flag sis5513: fail early for unsupported chipsets it821x: fix kzalloc() failure handling qd65xx: use IDE_HFLAG_SINGLE host flag qd65xx: always use ->selectproc method ide-cd: put proc-related functions together under single ifdef ide-cd: Replace __FUNCTION__ with __func__ IDE: Coding Style fixes to drivers/ide/ide-cd.c IDE: Coding Style fixes to drivers/ide/pci/cy82c693.c IDE: Coding Style fixes to drivers/ide/pci/it8213.c IDE: Coding Style fixes to drivers/ide/ide-floppy.c IDE: Coding Style fixes to drivers/ide/legacy/ali14xx.c IDE: Coding Style fixes to drivers/ide/legacy/hd.c IDE: Coding Style fixes to drivers/ide/pci/cmd640.c IDE: Coding Style fixes to drivers/ide/pci/opti621.c IDE: Coding Style fixes to drivers/ide/ide-pnp.c IDE: Coding Style fixes to drivers/ide/ide-proc.c IDE: Coding Style fixes to drivers/ide/legacy/ide-4drives.c IDE: Coding Style fixes to drivers/ide/legacy/umc8672.c IDE: Coding Style fixes to drivers/ide/pci/generic.c ...
This commit is contained in:
+1
-1
@@ -1031,7 +1031,7 @@ comment "Other IDE chipsets support"
|
||||
comment "Note: most of these also require special kernel boot parameters"
|
||||
|
||||
config BLK_DEV_4DRIVES
|
||||
bool "Generic 4 drives/port support"
|
||||
tristate "Generic 4 drives/port support"
|
||||
help
|
||||
Certain older chipsets, including the Tekram 690CD, use a single set
|
||||
of I/O ports at 0x1f0 to control up to four drives, instead of the
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include <asm/arch/bast-map.h>
|
||||
#include <asm/arch/bast-irq.h>
|
||||
|
||||
#define DRV_NAME "bast-ide"
|
||||
|
||||
static int __init bastide_register(unsigned int base, unsigned int aux, int irq)
|
||||
{
|
||||
ide_hwif_t *hwif;
|
||||
@@ -41,7 +43,7 @@ static int __init bastide_register(unsigned int base, unsigned int aux, int irq)
|
||||
hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20);
|
||||
hw.irq = irq;
|
||||
|
||||
hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
|
||||
hwif = ide_find_port();
|
||||
if (hwif == NULL)
|
||||
goto out;
|
||||
|
||||
@@ -53,6 +55,7 @@ static int __init bastide_register(unsigned int base, unsigned int aux, int irq)
|
||||
ide_init_port_data(hwif, i);
|
||||
|
||||
ide_init_port_hw(hwif, &hw);
|
||||
hwif->mmio = 1;
|
||||
hwif->quirkproc = NULL;
|
||||
|
||||
idx[0] = i;
|
||||
@@ -64,6 +67,8 @@ out:
|
||||
|
||||
static int __init bastide_init(void)
|
||||
{
|
||||
unsigned long base = BAST_VA_IDEPRI + BAST_IDE_CS;
|
||||
|
||||
/* we can treat the VR1000 and the BAST the same */
|
||||
|
||||
if (!(machine_is_bast() || machine_is_vr1000()))
|
||||
@@ -71,6 +76,11 @@ static int __init bastide_init(void)
|
||||
|
||||
printk("BAST: IDE driver, (c) 2003-2004 Simtec Electronics\n");
|
||||
|
||||
if (!request_mem_region(base, 0x400000, DRV_NAME)) {
|
||||
printk(KERN_ERR "%s: resources busy\n", DRV_NAME);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
bastide_register(BAST_VA_IDEPRI, BAST_VA_IDEPRIAUX, IRQ_IDE0);
|
||||
bastide_register(BAST_VA_IDESEC, BAST_VA_IDESECAUX, IRQ_IDE1);
|
||||
|
||||
|
||||
@@ -400,7 +400,7 @@ icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *e
|
||||
unsigned long port = (unsigned long)base + info->dataoffset;
|
||||
ide_hwif_t *hwif;
|
||||
|
||||
hwif = ide_find_port(port);
|
||||
hwif = ide_find_port();
|
||||
if (hwif) {
|
||||
int i;
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ static int __init ide_arm_init(void)
|
||||
ide_std_init_ports(&hw, IDE_ARM_IO, IDE_ARM_IO + 0x206);
|
||||
hw.irq = IDE_ARM_IRQ;
|
||||
|
||||
hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
|
||||
hwif = ide_find_port();
|
||||
if (hwif) {
|
||||
ide_init_port_hw(hwif, &hw);
|
||||
idx[0] = hwif->index;
|
||||
|
||||
@@ -96,11 +96,11 @@ static void palm_bk3710_setudmamode(void __iomem *base, unsigned int dev,
|
||||
u16 val16;
|
||||
|
||||
/* DMA Data Setup */
|
||||
t0 = (palm_bk3710_udmatimings[mode].cycletime + ide_palm_clk - 1)
|
||||
/ ide_palm_clk - 1;
|
||||
tenv = (20 + ide_palm_clk - 1) / ide_palm_clk - 1;
|
||||
trp = (palm_bk3710_udmatimings[mode].rptime + ide_palm_clk - 1)
|
||||
/ ide_palm_clk - 1;
|
||||
t0 = DIV_ROUND_UP(palm_bk3710_udmatimings[mode].cycletime,
|
||||
ide_palm_clk) - 1;
|
||||
tenv = DIV_ROUND_UP(20, ide_palm_clk) - 1;
|
||||
trp = DIV_ROUND_UP(palm_bk3710_udmatimings[mode].rptime,
|
||||
ide_palm_clk) - 1;
|
||||
|
||||
/* udmatim Register */
|
||||
val16 = readw(base + BK3710_UDMATIM) & (dev ? 0xFF0F : 0xFFF0);
|
||||
@@ -141,8 +141,8 @@ static void palm_bk3710_setdmamode(void __iomem *base, unsigned int dev,
|
||||
cycletime = max_t(int, t->cycle, min_cycle);
|
||||
|
||||
/* DMA Data Setup */
|
||||
t0 = (cycletime + ide_palm_clk - 1) / ide_palm_clk;
|
||||
td = (t->active + ide_palm_clk - 1) / ide_palm_clk;
|
||||
t0 = DIV_ROUND_UP(cycletime, ide_palm_clk);
|
||||
td = DIV_ROUND_UP(t->active, ide_palm_clk);
|
||||
tkw = t0 - td - 1;
|
||||
td -= 1;
|
||||
|
||||
@@ -168,9 +168,9 @@ static void palm_bk3710_setpiomode(void __iomem *base, ide_drive_t *mate,
|
||||
struct ide_timing *t;
|
||||
|
||||
/* PIO Data Setup */
|
||||
t0 = (cycletime + ide_palm_clk - 1) / ide_palm_clk;
|
||||
t2 = (ide_timing_find_mode(XFER_PIO_0 + mode)->active +
|
||||
ide_palm_clk - 1) / ide_palm_clk;
|
||||
t0 = DIV_ROUND_UP(cycletime, ide_palm_clk);
|
||||
t2 = DIV_ROUND_UP(ide_timing_find_mode(XFER_PIO_0 + mode)->active,
|
||||
ide_palm_clk);
|
||||
|
||||
t2i = t0 - t2 - 1;
|
||||
t2 -= 1;
|
||||
@@ -192,8 +192,8 @@ static void palm_bk3710_setpiomode(void __iomem *base, ide_drive_t *mate,
|
||||
|
||||
/* TASKFILE Setup */
|
||||
t = ide_timing_find_mode(XFER_PIO_0 + mode);
|
||||
t0 = (t->cyc8b + ide_palm_clk - 1) / ide_palm_clk;
|
||||
t2 = (t->act8b + ide_palm_clk - 1) / ide_palm_clk;
|
||||
t0 = DIV_ROUND_UP(t->cyc8b, ide_palm_clk);
|
||||
t2 = DIV_ROUND_UP(t->act8b, ide_palm_clk);
|
||||
|
||||
t2i = t0 - t2 - 1;
|
||||
t2 -= 1;
|
||||
@@ -378,7 +378,7 @@ static int __devinit palm_bk3710_probe(struct platform_device *pdev)
|
||||
hw.irq = irq->start;
|
||||
hw.chipset = ide_palm3710;
|
||||
|
||||
hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
|
||||
hwif = ide_find_port();
|
||||
if (hwif == NULL)
|
||||
goto out;
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
|
||||
goto release;
|
||||
}
|
||||
|
||||
hwif = ide_find_port((unsigned long)base);
|
||||
hwif = ide_find_port();
|
||||
if (hwif) {
|
||||
memset(&hw, 0, sizeof(hw));
|
||||
rapide_setup_ports(&hw, base, base + 0x818, 1 << 6, ec->irq);
|
||||
|
||||
@@ -804,7 +804,7 @@ static int __init init_e100_ide(void)
|
||||
|
||||
cris_setup_ports(&hw, cris_ide_base_address(h));
|
||||
|
||||
hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
|
||||
hwif = ide_find_port();
|
||||
if (hwif == NULL)
|
||||
continue;
|
||||
ide_init_port_data(hwif, hwif->index);
|
||||
|
||||
@@ -99,8 +99,7 @@ static int __init h8300_ide_init(void)
|
||||
|
||||
hw_setup(&hw);
|
||||
|
||||
/* register if */
|
||||
hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
|
||||
hwif = ide_find_port();
|
||||
if (hwif == NULL) {
|
||||
printk(KERN_ERR "ide-h8300: IDE I/F register failed\n");
|
||||
return -ENOENT;
|
||||
|
||||
+152
-260
File diff suppressed because it is too large
Load Diff
@@ -119,10 +119,6 @@ struct cdrom_info {
|
||||
|
||||
struct atapi_toc *toc;
|
||||
|
||||
unsigned long sector_buffered;
|
||||
unsigned long nsectors_buffered;
|
||||
unsigned char *buffer;
|
||||
|
||||
/* The result of the last successful request sense command
|
||||
on this device. */
|
||||
struct request_sense sense_data;
|
||||
|
||||
+87
-72
@@ -16,8 +16,6 @@
|
||||
|
||||
#define IDEDISK_VERSION "1.18"
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/string.h>
|
||||
@@ -88,7 +86,7 @@ static void ide_disk_put(struct ide_disk_obj *idkp)
|
||||
*
|
||||
* It is called only once for each drive.
|
||||
*/
|
||||
static int lba_capacity_is_ok (struct hd_driveid *id)
|
||||
static int lba_capacity_is_ok(struct hd_driveid *id)
|
||||
{
|
||||
unsigned long lba_sects, chs_sects, head, tail;
|
||||
|
||||
@@ -176,7 +174,8 @@ static void ide_tf_set_cmd(ide_drive_t *drive, ide_task_t *task, u8 dma)
|
||||
* __ide_do_rw_disk() issues READ and WRITE commands to a disk,
|
||||
* using LBA if supported, or CHS otherwise, to address sectors.
|
||||
*/
|
||||
static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, sector_t block)
|
||||
static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
|
||||
sector_t block)
|
||||
{
|
||||
ide_hwif_t *hwif = HWIF(drive);
|
||||
unsigned int dma = drive->using_dma;
|
||||
@@ -228,7 +227,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
|
||||
tf->device = (block >> 8) & 0xf;
|
||||
}
|
||||
} else {
|
||||
unsigned int sect,head,cyl,track;
|
||||
unsigned int sect, head, cyl, track;
|
||||
|
||||
track = (int)block / drive->sect;
|
||||
sect = (int)block % drive->sect + 1;
|
||||
head = track % drive->head;
|
||||
@@ -271,7 +271,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
|
||||
* 1073741822 == 549756 MB or 48bit addressing fake drive
|
||||
*/
|
||||
|
||||
static ide_startstop_t ide_do_rw_disk (ide_drive_t *drive, struct request *rq, sector_t block)
|
||||
static ide_startstop_t ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
|
||||
sector_t block)
|
||||
{
|
||||
ide_hwif_t *hwif = HWIF(drive);
|
||||
|
||||
@@ -452,7 +453,7 @@ static void idedisk_check_hpa(ide_drive_t *drive)
|
||||
* in above order (i.e., if value of higher priority is available,
|
||||
* reset will be ignored).
|
||||
*/
|
||||
static void init_idedisk_capacity (ide_drive_t *drive)
|
||||
static void init_idedisk_capacity(ide_drive_t *drive)
|
||||
{
|
||||
struct hd_driveid *id = drive->id;
|
||||
/*
|
||||
@@ -479,7 +480,7 @@ static void init_idedisk_capacity (ide_drive_t *drive)
|
||||
}
|
||||
}
|
||||
|
||||
static sector_t idedisk_capacity (ide_drive_t *drive)
|
||||
static sector_t idedisk_capacity(ide_drive_t *drive)
|
||||
{
|
||||
return drive->capacity64 - drive->sect0;
|
||||
}
|
||||
@@ -524,10 +525,11 @@ static int proc_idedisk_read_cache
|
||||
int len;
|
||||
|
||||
if (drive->id_read)
|
||||
len = sprintf(out,"%i\n", drive->id->buf_size / 2);
|
||||
len = sprintf(out, "%i\n", drive->id->buf_size / 2);
|
||||
else
|
||||
len = sprintf(out,"(none)\n");
|
||||
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
|
||||
len = sprintf(out, "(none)\n");
|
||||
|
||||
PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
|
||||
}
|
||||
|
||||
static int proc_idedisk_read_capacity
|
||||
@@ -536,54 +538,52 @@ static int proc_idedisk_read_capacity
|
||||
ide_drive_t*drive = (ide_drive_t *)data;
|
||||
int len;
|
||||
|
||||
len = sprintf(page,"%llu\n", (long long)idedisk_capacity(drive));
|
||||
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
|
||||
len = sprintf(page, "%llu\n", (long long)idedisk_capacity(drive));
|
||||
|
||||
PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
|
||||
}
|
||||
|
||||
static int proc_idedisk_read_smart_thresholds
|
||||
(char *page, char **start, off_t off, int count, int *eof, void *data)
|
||||
static int proc_idedisk_read_smart(char *page, char **start, off_t off,
|
||||
int count, int *eof, void *data, u8 sub_cmd)
|
||||
{
|
||||
ide_drive_t *drive = (ide_drive_t *)data;
|
||||
int len = 0, i = 0;
|
||||
|
||||
if (get_smart_data(drive, page, SMART_READ_THRESHOLDS) == 0) {
|
||||
if (get_smart_data(drive, page, sub_cmd) == 0) {
|
||||
unsigned short *val = (unsigned short *) page;
|
||||
char *out = ((char *)val) + (SECTOR_WORDS * 4);
|
||||
page = out;
|
||||
do {
|
||||
out += sprintf(out, "%04x%c", le16_to_cpu(*val), (++i & 7) ? ' ' : '\n');
|
||||
out += sprintf(out, "%04x%c", le16_to_cpu(*val),
|
||||
(++i & 7) ? ' ' : '\n');
|
||||
val += 1;
|
||||
} while (i < (SECTOR_WORDS * 2));
|
||||
len = out - page;
|
||||
}
|
||||
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
|
||||
|
||||
PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
|
||||
}
|
||||
|
||||
static int proc_idedisk_read_smart_values
|
||||
static int proc_idedisk_read_sv
|
||||
(char *page, char **start, off_t off, int count, int *eof, void *data)
|
||||
{
|
||||
ide_drive_t *drive = (ide_drive_t *)data;
|
||||
int len = 0, i = 0;
|
||||
return proc_idedisk_read_smart(page, start, off, count, eof, data,
|
||||
SMART_READ_VALUES);
|
||||
}
|
||||
|
||||
if (get_smart_data(drive, page, SMART_READ_VALUES) == 0) {
|
||||
unsigned short *val = (unsigned short *) page;
|
||||
char *out = ((char *)val) + (SECTOR_WORDS * 4);
|
||||
page = out;
|
||||
do {
|
||||
out += sprintf(out, "%04x%c", le16_to_cpu(*val), (++i & 7) ? ' ' : '\n');
|
||||
val += 1;
|
||||
} while (i < (SECTOR_WORDS * 2));
|
||||
len = out - page;
|
||||
}
|
||||
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
|
||||
static int proc_idedisk_read_st
|
||||
(char *page, char **start, off_t off, int count, int *eof, void *data)
|
||||
{
|
||||
return proc_idedisk_read_smart(page, start, off, count, eof, data,
|
||||
SMART_READ_THRESHOLDS);
|
||||
}
|
||||
|
||||
static ide_proc_entry_t idedisk_proc[] = {
|
||||
{ "cache", S_IFREG|S_IRUGO, proc_idedisk_read_cache, NULL },
|
||||
{ "capacity", S_IFREG|S_IRUGO, proc_idedisk_read_capacity, NULL },
|
||||
{ "geometry", S_IFREG|S_IRUGO, proc_ide_read_geometry, NULL },
|
||||
{ "smart_values", S_IFREG|S_IRUSR, proc_idedisk_read_smart_values, NULL },
|
||||
{ "smart_thresholds", S_IFREG|S_IRUSR, proc_idedisk_read_smart_thresholds, NULL },
|
||||
{ "cache", S_IFREG|S_IRUGO, proc_idedisk_read_cache, NULL },
|
||||
{ "capacity", S_IFREG|S_IRUGO, proc_idedisk_read_capacity, NULL },
|
||||
{ "geometry", S_IFREG|S_IRUGO, proc_ide_read_geometry, NULL },
|
||||
{ "smart_values", S_IFREG|S_IRUSR, proc_idedisk_read_sv, NULL },
|
||||
{ "smart_thresholds", S_IFREG|S_IRUSR, proc_idedisk_read_st, NULL },
|
||||
{ NULL, 0, NULL, NULL }
|
||||
};
|
||||
#endif /* CONFIG_IDE_PROC_FS */
|
||||
@@ -625,12 +625,13 @@ static int set_multcount(ide_drive_t *drive, int arg)
|
||||
if (drive->special.b.set_multmode)
|
||||
return -EBUSY;
|
||||
|
||||
ide_init_drive_cmd (&rq);
|
||||
ide_init_drive_cmd(&rq);
|
||||
rq.cmd_type = REQ_TYPE_ATA_TASKFILE;
|
||||
|
||||
drive->mult_req = arg;
|
||||
drive->special.b.set_multmode = 1;
|
||||
(void) ide_do_drive_cmd (drive, &rq, ide_wait);
|
||||
(void)ide_do_drive_cmd(drive, &rq, ide_wait);
|
||||
|
||||
return (drive->mult_count == arg) ? 0 : -EIO;
|
||||
}
|
||||
|
||||
@@ -706,7 +707,7 @@ static int write_cache(ide_drive_t *drive, int arg)
|
||||
return err;
|
||||
}
|
||||
|
||||
static int do_idedisk_flushcache (ide_drive_t *drive)
|
||||
static int do_idedisk_flushcache(ide_drive_t *drive)
|
||||
{
|
||||
ide_task_t args;
|
||||
|
||||
@@ -719,7 +720,7 @@ static int do_idedisk_flushcache (ide_drive_t *drive)
|
||||
return ide_no_data_taskfile(drive, &args);
|
||||
}
|
||||
|
||||
static int set_acoustic (ide_drive_t *drive, int arg)
|
||||
static int set_acoustic(ide_drive_t *drive, int arg)
|
||||
{
|
||||
ide_task_t args;
|
||||
|
||||
@@ -753,7 +754,7 @@ static int set_lba_addressing(ide_drive_t *drive, int arg)
|
||||
return 0;
|
||||
|
||||
if (!idedisk_supports_lba48(drive->id))
|
||||
return -EIO;
|
||||
return -EIO;
|
||||
drive->addressing = arg;
|
||||
return 0;
|
||||
}
|
||||
@@ -763,23 +764,35 @@ static void idedisk_add_settings(ide_drive_t *drive)
|
||||
{
|
||||
struct hd_driveid *id = drive->id;
|
||||
|
||||
ide_add_setting(drive, "bios_cyl", SETTING_RW, TYPE_INT, 0, 65535, 1, 1, &drive->bios_cyl, NULL);
|
||||
ide_add_setting(drive, "bios_head", SETTING_RW, TYPE_BYTE, 0, 255, 1, 1, &drive->bios_head, NULL);
|
||||
ide_add_setting(drive, "bios_sect", SETTING_RW, TYPE_BYTE, 0, 63, 1, 1, &drive->bios_sect, NULL);
|
||||
ide_add_setting(drive, "address", SETTING_RW, TYPE_BYTE, 0, 2, 1, 1, &drive->addressing, set_lba_addressing);
|
||||
ide_add_setting(drive, "multcount", SETTING_RW, TYPE_BYTE, 0, id->max_multsect, 1, 1, &drive->mult_count, set_multcount);
|
||||
ide_add_setting(drive, "nowerr", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->nowerr, set_nowerr);
|
||||
ide_add_setting(drive, "lun", SETTING_RW, TYPE_INT, 0, 7, 1, 1, &drive->lun, NULL);
|
||||
ide_add_setting(drive, "wcache", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->wcache, write_cache);
|
||||
ide_add_setting(drive, "acoustic", SETTING_RW, TYPE_BYTE, 0, 254, 1, 1, &drive->acoustic, set_acoustic);
|
||||
ide_add_setting(drive, "failures", SETTING_RW, TYPE_INT, 0, 65535, 1, 1, &drive->failures, NULL);
|
||||
ide_add_setting(drive, "max_failures", SETTING_RW, TYPE_INT, 0, 65535, 1, 1, &drive->max_failures, NULL);
|
||||
ide_add_setting(drive, "bios_cyl", SETTING_RW, TYPE_INT, 0, 65535, 1, 1,
|
||||
&drive->bios_cyl, NULL);
|
||||
ide_add_setting(drive, "bios_head", SETTING_RW, TYPE_BYTE, 0, 255, 1, 1,
|
||||
&drive->bios_head, NULL);
|
||||
ide_add_setting(drive, "bios_sect", SETTING_RW, TYPE_BYTE, 0, 63, 1, 1,
|
||||
&drive->bios_sect, NULL);
|
||||
ide_add_setting(drive, "address", SETTING_RW, TYPE_BYTE, 0, 2, 1, 1,
|
||||
&drive->addressing, set_lba_addressing);
|
||||
ide_add_setting(drive, "multcount", SETTING_RW, TYPE_BYTE, 0,
|
||||
id->max_multsect, 1, 1, &drive->mult_count,
|
||||
set_multcount);
|
||||
ide_add_setting(drive, "nowerr", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1,
|
||||
&drive->nowerr, set_nowerr);
|
||||
ide_add_setting(drive, "lun", SETTING_RW, TYPE_INT, 0, 7, 1, 1,
|
||||
&drive->lun, NULL);
|
||||
ide_add_setting(drive, "wcache", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1,
|
||||
&drive->wcache, write_cache);
|
||||
ide_add_setting(drive, "acoustic", SETTING_RW, TYPE_BYTE, 0, 254, 1, 1,
|
||||
&drive->acoustic, set_acoustic);
|
||||
ide_add_setting(drive, "failures", SETTING_RW, TYPE_INT, 0, 65535, 1, 1,
|
||||
&drive->failures, NULL);
|
||||
ide_add_setting(drive, "max_failures", SETTING_RW, TYPE_INT, 0, 65535,
|
||||
1, 1, &drive->max_failures, NULL);
|
||||
}
|
||||
#else
|
||||
static inline void idedisk_add_settings(ide_drive_t *drive) { ; }
|
||||
#endif
|
||||
|
||||
static void idedisk_setup (ide_drive_t *drive)
|
||||
static void idedisk_setup(ide_drive_t *drive)
|
||||
{
|
||||
ide_hwif_t *hwif = drive->hwif;
|
||||
struct hd_driveid *id = drive->id;
|
||||
@@ -792,11 +805,10 @@ static void idedisk_setup (ide_drive_t *drive)
|
||||
|
||||
if (drive->removable) {
|
||||
/*
|
||||
* Removable disks (eg. SYQUEST); ignore 'WD' drives
|
||||
* Removable disks (eg. SYQUEST); ignore 'WD' drives
|
||||
*/
|
||||
if (id->model[0] != 'W' || id->model[1] != 'D') {
|
||||
if (id->model[0] != 'W' || id->model[1] != 'D')
|
||||
drive->doorlocking = 1;
|
||||
}
|
||||
}
|
||||
|
||||
(void)set_lba_addressing(drive, 1);
|
||||
@@ -810,10 +822,11 @@ static void idedisk_setup (ide_drive_t *drive)
|
||||
blk_queue_max_sectors(drive->queue, max_s);
|
||||
}
|
||||
|
||||
printk(KERN_INFO "%s: max request size: %dKiB\n", drive->name, drive->queue->max_sectors / 2);
|
||||
printk(KERN_INFO "%s: max request size: %dKiB\n", drive->name,
|
||||
drive->queue->max_sectors / 2);
|
||||
|
||||
/* calculate drive capacity, and select LBA if possible */
|
||||
init_idedisk_capacity (drive);
|
||||
init_idedisk_capacity(drive);
|
||||
|
||||
/* limit drive capacity to 137GB if LBA48 cannot be used */
|
||||
if (drive->addressing == 0 && drive->capacity64 > 1ULL << 28) {
|
||||
@@ -826,9 +839,9 @@ static void idedisk_setup (ide_drive_t *drive)
|
||||
|
||||
if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && drive->addressing) {
|
||||
if (drive->capacity64 > 1ULL << 28) {
|
||||
printk(KERN_INFO "%s: cannot use LBA48 DMA - PIO mode will"
|
||||
" be used for accessing sectors > %u\n",
|
||||
drive->name, 1 << 28);
|
||||
printk(KERN_INFO "%s: cannot use LBA48 DMA - PIO mode"
|
||||
" will be used for accessing sectors "
|
||||
"> %u\n", drive->name, 1 << 28);
|
||||
} else
|
||||
drive->addressing = 0;
|
||||
}
|
||||
@@ -837,7 +850,8 @@ static void idedisk_setup (ide_drive_t *drive)
|
||||
* if possible, give fdisk access to more of the drive,
|
||||
* by correcting bios_cyls:
|
||||
*/
|
||||
capacity = idedisk_capacity (drive);
|
||||
capacity = idedisk_capacity(drive);
|
||||
|
||||
if (!drive->forced_geom) {
|
||||
|
||||
if (idedisk_supports_lba48(drive->id)) {
|
||||
@@ -993,7 +1007,8 @@ static int idedisk_open(struct inode *inode, struct file *filp)
|
||||
struct ide_disk_obj *idkp;
|
||||
ide_drive_t *drive;
|
||||
|
||||
if (!(idkp = ide_disk_get(disk)))
|
||||
idkp = ide_disk_get(disk);
|
||||
if (idkp == NULL)
|
||||
return -ENXIO;
|
||||
|
||||
drive = idkp->drive;
|
||||
@@ -1115,13 +1130,13 @@ static int idedisk_revalidate_disk(struct gendisk *disk)
|
||||
}
|
||||
|
||||
static struct block_device_operations idedisk_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = idedisk_open,
|
||||
.release = idedisk_release,
|
||||
.ioctl = idedisk_ioctl,
|
||||
.getgeo = idedisk_getgeo,
|
||||
.media_changed = idedisk_media_changed,
|
||||
.revalidate_disk= idedisk_revalidate_disk
|
||||
.owner = THIS_MODULE,
|
||||
.open = idedisk_open,
|
||||
.release = idedisk_release,
|
||||
.ioctl = idedisk_ioctl,
|
||||
.getgeo = idedisk_getgeo,
|
||||
.media_changed = idedisk_media_changed,
|
||||
.revalidate_disk = idedisk_revalidate_disk
|
||||
};
|
||||
|
||||
MODULE_DESCRIPTION("ATA DISK Driver");
|
||||
@@ -1184,7 +1199,7 @@ failed:
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static void __exit idedisk_exit (void)
|
||||
static void __exit idedisk_exit(void)
|
||||
{
|
||||
driver_unregister(&idedisk_driver.gen_driver);
|
||||
}
|
||||
|
||||
+2
-11
@@ -703,17 +703,8 @@ static int ide_tune_dma(ide_drive_t *drive)
|
||||
|
||||
speed = ide_max_dma_mode(drive);
|
||||
|
||||
if (!speed) {
|
||||
/* is this really correct/needed? */
|
||||
if ((hwif->host_flags & IDE_HFLAG_CY82C693) &&
|
||||
ide_dma_good_drive(drive))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (hwif->host_flags & IDE_HFLAG_NO_SET_MODE)
|
||||
return 1;
|
||||
if (!speed)
|
||||
return 0;
|
||||
|
||||
if (ide_set_dma_mode(drive, speed))
|
||||
return 0;
|
||||
|
||||
@@ -396,7 +396,7 @@ static void idefloppy_retry_pc(ide_drive_t *drive)
|
||||
}
|
||||
|
||||
/* The usual interrupt handler called during a packet command. */
|
||||
static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
|
||||
static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
|
||||
{
|
||||
idefloppy_floppy_t *floppy = drive->driver_data;
|
||||
ide_hwif_t *hwif = drive->hwif;
|
||||
@@ -1596,13 +1596,13 @@ static int idefloppy_revalidate_disk(struct gendisk *disk)
|
||||
}
|
||||
|
||||
static struct block_device_operations idefloppy_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = idefloppy_open,
|
||||
.release = idefloppy_release,
|
||||
.ioctl = idefloppy_ioctl,
|
||||
.getgeo = idefloppy_getgeo,
|
||||
.media_changed = idefloppy_media_changed,
|
||||
.revalidate_disk= idefloppy_revalidate_disk
|
||||
.owner = THIS_MODULE,
|
||||
.open = idefloppy_open,
|
||||
.release = idefloppy_release,
|
||||
.ioctl = idefloppy_ioctl,
|
||||
.getgeo = idefloppy_getgeo,
|
||||
.media_changed = idefloppy_media_changed,
|
||||
.revalidate_disk = idefloppy_revalidate_disk
|
||||
};
|
||||
|
||||
static int ide_floppy_probe(ide_drive_t *drive)
|
||||
|
||||
@@ -33,7 +33,7 @@ static ssize_t store_add(struct class *cls, const char *buf, size_t n)
|
||||
if (sscanf(buf, "%x:%x:%d", &base, &ctl, &irq) != 3)
|
||||
return -EINVAL;
|
||||
|
||||
hwif = ide_find_port(base);
|
||||
hwif = ide_find_port();
|
||||
if (hwif == NULL)
|
||||
return -ENOENT;
|
||||
|
||||
@@ -90,11 +90,21 @@ static int __init ide_generic_init(void)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_HWIFS; i++) {
|
||||
ide_hwif_t *hwif = &ide_hwifs[i];
|
||||
ide_hwif_t *hwif;
|
||||
unsigned long io_addr = ide_default_io_base(i);
|
||||
hw_regs_t hw;
|
||||
|
||||
if (hwif->chipset == ide_unknown && io_addr) {
|
||||
if (io_addr) {
|
||||
/*
|
||||
* Skip probing if the corresponding
|
||||
* slot is already occupied.
|
||||
*/
|
||||
hwif = ide_find_port();
|
||||
if (hwif == NULL || hwif->index != i) {
|
||||
idx[i] = 0xff;
|
||||
continue;
|
||||
}
|
||||
|
||||
memset(&hw, 0, sizeof(hw));
|
||||
ide_std_init_ports(&hw, io_addr, io_addr + 0x206);
|
||||
hw.irq = ide_default_irq(io_addr);
|
||||
|
||||
@@ -726,10 +726,6 @@ static ide_startstop_t do_special (ide_drive_t *drive)
|
||||
s->b.set_tune = 0;
|
||||
|
||||
if (set_pio_mode_abuse(drive->hwif, req_pio)) {
|
||||
|
||||
if (hwif->set_pio_mode == NULL)
|
||||
return ide_stopped;
|
||||
|
||||
/*
|
||||
* take ide_lock for drive->[no_]unmask/[no_]io_32bit
|
||||
*/
|
||||
|
||||
+10
-12
@@ -274,16 +274,6 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode)
|
||||
if (overridden)
|
||||
printk(KERN_INFO "%s: tPIO > 2, assuming tPIO = 2\n",
|
||||
drive->name);
|
||||
|
||||
/*
|
||||
* Conservative "downgrade" for all pre-ATA2 drives
|
||||
*/
|
||||
if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_DOWNGRADE) == 0 &&
|
||||
pio_mode && pio_mode < 4) {
|
||||
pio_mode--;
|
||||
printk(KERN_INFO "%s: applying conservative "
|
||||
"PIO \"downgrade\"\n", drive->name);
|
||||
}
|
||||
}
|
||||
|
||||
if (pio_mode > max_mode)
|
||||
@@ -300,7 +290,8 @@ void ide_set_pio(ide_drive_t *drive, u8 req_pio)
|
||||
ide_hwif_t *hwif = drive->hwif;
|
||||
u8 host_pio, pio;
|
||||
|
||||
if (hwif->set_pio_mode == NULL)
|
||||
if (hwif->set_pio_mode == NULL ||
|
||||
(hwif->host_flags & IDE_HFLAG_NO_SET_MODE))
|
||||
return;
|
||||
|
||||
BUG_ON(hwif->pio_mask == 0x00);
|
||||
@@ -353,6 +344,9 @@ int ide_set_pio_mode(ide_drive_t *drive, const u8 mode)
|
||||
{
|
||||
ide_hwif_t *hwif = drive->hwif;
|
||||
|
||||
if (hwif->host_flags & IDE_HFLAG_NO_SET_MODE)
|
||||
return 0;
|
||||
|
||||
if (hwif->set_pio_mode == NULL)
|
||||
return -1;
|
||||
|
||||
@@ -380,6 +374,9 @@ int ide_set_dma_mode(ide_drive_t *drive, const u8 mode)
|
||||
{
|
||||
ide_hwif_t *hwif = drive->hwif;
|
||||
|
||||
if (hwif->host_flags & IDE_HFLAG_NO_SET_MODE)
|
||||
return 0;
|
||||
|
||||
if (hwif->set_dma_mode == NULL)
|
||||
return -1;
|
||||
|
||||
@@ -410,7 +407,8 @@ int ide_set_xfer_rate(ide_drive_t *drive, u8 rate)
|
||||
{
|
||||
ide_hwif_t *hwif = drive->hwif;
|
||||
|
||||
if (hwif->set_dma_mode == NULL)
|
||||
if (hwif->set_dma_mode == NULL ||
|
||||
(hwif->host_flags & IDE_HFLAG_NO_SET_MODE))
|
||||
return -1;
|
||||
|
||||
rate = ide_rate_filter(drive, rate);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* (for example /usr/src/linux/COPYING); if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
@@ -20,12 +20,12 @@
|
||||
|
||||
/* Add your devices here :)) */
|
||||
static struct pnp_device_id idepnp_devices[] = {
|
||||
/* Generic ESDI/IDE/ATA compatible hard disk controller */
|
||||
/* Generic ESDI/IDE/ATA compatible hard disk controller */
|
||||
{.id = "PNP0600", .driver_data = 0},
|
||||
{.id = ""}
|
||||
};
|
||||
|
||||
static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id)
|
||||
static int idepnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
|
||||
{
|
||||
hw_regs_t hw;
|
||||
ide_hwif_t *hwif;
|
||||
@@ -38,7 +38,7 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id
|
||||
pnp_port_start(dev, 1));
|
||||
hw.irq = pnp_irq(dev, 0);
|
||||
|
||||
hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
|
||||
hwif = ide_find_port();
|
||||
if (hwif) {
|
||||
u8 index = hwif->index;
|
||||
u8 idx[4] = { index, 0xff, 0xff, 0xff };
|
||||
@@ -47,7 +47,7 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id
|
||||
ide_init_port_hw(hwif, &hw);
|
||||
|
||||
printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index);
|
||||
pnp_set_drvdata(dev,hwif);
|
||||
pnp_set_drvdata(dev, hwif);
|
||||
|
||||
ide_device_add(idx, NULL);
|
||||
|
||||
@@ -57,7 +57,7 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void idepnp_remove(struct pnp_dev * dev)
|
||||
static void idepnp_remove(struct pnp_dev *dev)
|
||||
{
|
||||
ide_hwif_t *hwif = pnp_get_drvdata(dev);
|
||||
|
||||
|
||||
@@ -1444,6 +1444,54 @@ static int ide_sysfs_register_port(ide_hwif_t *hwif)
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
* ide_find_port_slot - find free ide_hwifs[] slot
|
||||
* @d: IDE port info
|
||||
*
|
||||
* Return the new hwif. If we are out of free slots return NULL.
|
||||
*/
|
||||
|
||||
ide_hwif_t *ide_find_port_slot(const struct ide_port_info *d)
|
||||
{
|
||||
ide_hwif_t *hwif;
|
||||
int i;
|
||||
u8 bootable = (d && (d->host_flags & IDE_HFLAG_NON_BOOTABLE)) ? 0 : 1;
|
||||
|
||||
/*
|
||||
* Claim an unassigned slot.
|
||||
*
|
||||
* Give preference to claiming other slots before claiming ide0/ide1,
|
||||
* just in case there's another interface yet-to-be-scanned
|
||||
* which uses ports 0x1f0/0x170 (the ide0/ide1 defaults).
|
||||
*
|
||||
* Unless there is a bootable card that does not use the standard
|
||||
* ports 0x1f0/0x170 (the ide0/ide1 defaults).
|
||||
*/
|
||||
if (bootable) {
|
||||
i = (d && (d->host_flags & IDE_HFLAG_QD_2ND_PORT)) ? 1 : 0;
|
||||
|
||||
for (; i < MAX_HWIFS; i++) {
|
||||
hwif = &ide_hwifs[i];
|
||||
if (hwif->chipset == ide_unknown)
|
||||
return hwif;
|
||||
}
|
||||
} else {
|
||||
for (i = 2; i < MAX_HWIFS; i++) {
|
||||
hwif = &ide_hwifs[i];
|
||||
if (hwif->chipset == ide_unknown)
|
||||
return hwif;
|
||||
}
|
||||
for (i = 0; i < 2 && i < MAX_HWIFS; i++) {
|
||||
hwif = &ide_hwifs[i];
|
||||
if (hwif->chipset == ide_unknown)
|
||||
return hwif;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ide_find_port_slot);
|
||||
|
||||
int ide_device_add_all(u8 *idx, const struct ide_port_info *d)
|
||||
{
|
||||
ide_hwif_t *hwif, *mate = NULL;
|
||||
|
||||
+75
-80
@@ -47,28 +47,28 @@ static int proc_ide_read_imodel
|
||||
const char *name;
|
||||
|
||||
switch (hwif->chipset) {
|
||||
case ide_generic: name = "generic"; break;
|
||||
case ide_pci: name = "pci"; break;
|
||||
case ide_cmd640: name = "cmd640"; break;
|
||||
case ide_dtc2278: name = "dtc2278"; break;
|
||||
case ide_ali14xx: name = "ali14xx"; break;
|
||||
case ide_qd65xx: name = "qd65xx"; break;
|
||||
case ide_umc8672: name = "umc8672"; break;
|
||||
case ide_ht6560b: name = "ht6560b"; break;
|
||||
case ide_rz1000: name = "rz1000"; break;
|
||||
case ide_trm290: name = "trm290"; break;
|
||||
case ide_cmd646: name = "cmd646"; break;
|
||||
case ide_cy82c693: name = "cy82c693"; break;
|
||||
case ide_4drives: name = "4drives"; break;
|
||||
case ide_pmac: name = "mac-io"; break;
|
||||
case ide_au1xxx: name = "au1xxx"; break;
|
||||
case ide_palm3710: name = "palm3710"; break;
|
||||
case ide_etrax100: name = "etrax100"; break;
|
||||
case ide_acorn: name = "acorn"; break;
|
||||
default: name = "(unknown)"; break;
|
||||
case ide_generic: name = "generic"; break;
|
||||
case ide_pci: name = "pci"; break;
|
||||
case ide_cmd640: name = "cmd640"; break;
|
||||
case ide_dtc2278: name = "dtc2278"; break;
|
||||
case ide_ali14xx: name = "ali14xx"; break;
|
||||
case ide_qd65xx: name = "qd65xx"; break;
|
||||
case ide_umc8672: name = "umc8672"; break;
|
||||
case ide_ht6560b: name = "ht6560b"; break;
|
||||
case ide_rz1000: name = "rz1000"; break;
|
||||
case ide_trm290: name = "trm290"; break;
|
||||
case ide_cmd646: name = "cmd646"; break;
|
||||
case ide_cy82c693: name = "cy82c693"; break;
|
||||
case ide_4drives: name = "4drives"; break;
|
||||
case ide_pmac: name = "mac-io"; break;
|
||||
case ide_au1xxx: name = "au1xxx"; break;
|
||||
case ide_palm3710: name = "palm3710"; break;
|
||||
case ide_etrax100: name = "etrax100"; break;
|
||||
case ide_acorn: name = "acorn"; break;
|
||||
default: name = "(unknown)"; break;
|
||||
}
|
||||
len = sprintf(page, "%s\n", name);
|
||||
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
|
||||
PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
|
||||
}
|
||||
|
||||
static int proc_ide_read_mate
|
||||
@@ -81,7 +81,7 @@ static int proc_ide_read_mate
|
||||
len = sprintf(page, "%s\n", hwif->mate->name);
|
||||
else
|
||||
len = sprintf(page, "(none)\n");
|
||||
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
|
||||
PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
|
||||
}
|
||||
|
||||
static int proc_ide_read_channel
|
||||
@@ -93,7 +93,7 @@ static int proc_ide_read_channel
|
||||
page[0] = hwif->channel ? '1' : '0';
|
||||
page[1] = '\n';
|
||||
len = 2;
|
||||
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
|
||||
PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
|
||||
}
|
||||
|
||||
static int proc_ide_read_identify
|
||||
@@ -120,7 +120,7 @@ static int proc_ide_read_identify
|
||||
len = out - page;
|
||||
}
|
||||
}
|
||||
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
|
||||
PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -197,7 +197,7 @@ EXPORT_SYMBOL(ide_add_setting);
|
||||
* The caller must hold the setting semaphore.
|
||||
*/
|
||||
|
||||
static void __ide_remove_setting (ide_drive_t *drive, char *name)
|
||||
static void __ide_remove_setting(ide_drive_t *drive, char *name)
|
||||
{
|
||||
ide_settings_t **p, *setting;
|
||||
|
||||
@@ -205,7 +205,8 @@ static void __ide_remove_setting (ide_drive_t *drive, char *name)
|
||||
|
||||
while ((*p) && strcmp((*p)->name, name))
|
||||
p = &((*p)->next);
|
||||
if ((setting = (*p)) == NULL)
|
||||
setting = (*p);
|
||||
if (setting == NULL)
|
||||
return;
|
||||
|
||||
(*p) = setting->next;
|
||||
@@ -223,7 +224,7 @@ static void __ide_remove_setting (ide_drive_t *drive, char *name)
|
||||
* caller must hold ide_setting_mtx.
|
||||
*/
|
||||
|
||||
static void auto_remove_settings (ide_drive_t *drive)
|
||||
static void auto_remove_settings(ide_drive_t *drive)
|
||||
{
|
||||
ide_settings_t *setting;
|
||||
repeat:
|
||||
@@ -279,16 +280,16 @@ static int ide_read_setting(ide_drive_t *drive, ide_settings_t *setting)
|
||||
|
||||
if ((setting->rw & SETTING_READ)) {
|
||||
spin_lock_irqsave(&ide_lock, flags);
|
||||
switch(setting->data_type) {
|
||||
case TYPE_BYTE:
|
||||
val = *((u8 *) setting->data);
|
||||
break;
|
||||
case TYPE_SHORT:
|
||||
val = *((u16 *) setting->data);
|
||||
break;
|
||||
case TYPE_INT:
|
||||
val = *((u32 *) setting->data);
|
||||
break;
|
||||
switch (setting->data_type) {
|
||||
case TYPE_BYTE:
|
||||
val = *((u8 *) setting->data);
|
||||
break;
|
||||
case TYPE_SHORT:
|
||||
val = *((u16 *) setting->data);
|
||||
break;
|
||||
case TYPE_INT:
|
||||
val = *((u32 *) setting->data);
|
||||
break;
|
||||
}
|
||||
spin_unlock_irqrestore(&ide_lock, flags);
|
||||
}
|
||||
@@ -326,15 +327,15 @@ static int ide_write_setting(ide_drive_t *drive, ide_settings_t *setting, int va
|
||||
if (ide_spin_wait_hwgroup(drive))
|
||||
return -EBUSY;
|
||||
switch (setting->data_type) {
|
||||
case TYPE_BYTE:
|
||||
*((u8 *) setting->data) = val;
|
||||
break;
|
||||
case TYPE_SHORT:
|
||||
*((u16 *) setting->data) = val;
|
||||
break;
|
||||
case TYPE_INT:
|
||||
*((u32 *) setting->data) = val;
|
||||
break;
|
||||
case TYPE_BYTE:
|
||||
*((u8 *) setting->data) = val;
|
||||
break;
|
||||
case TYPE_SHORT:
|
||||
*((u16 *) setting->data) = val;
|
||||
break;
|
||||
case TYPE_INT:
|
||||
*((u32 *) setting->data) = val;
|
||||
break;
|
||||
}
|
||||
spin_unlock_irq(&ide_lock);
|
||||
return 0;
|
||||
@@ -390,7 +391,7 @@ void ide_add_generic_settings (ide_drive_t *drive)
|
||||
|
||||
static void proc_ide_settings_warn(void)
|
||||
{
|
||||
static int warned = 0;
|
||||
static int warned;
|
||||
|
||||
if (warned)
|
||||
return;
|
||||
@@ -413,11 +414,12 @@ static int proc_ide_read_settings
|
||||
mutex_lock(&ide_setting_mtx);
|
||||
out += sprintf(out, "name\t\t\tvalue\t\tmin\t\tmax\t\tmode\n");
|
||||
out += sprintf(out, "----\t\t\t-----\t\t---\t\t---\t\t----\n");
|
||||
while(setting) {
|
||||
while (setting) {
|
||||
mul_factor = setting->mul_factor;
|
||||
div_factor = setting->div_factor;
|
||||
out += sprintf(out, "%-24s", setting->name);
|
||||
if ((rc = ide_read_setting(drive, setting)) >= 0)
|
||||
rc = ide_read_setting(drive, setting);
|
||||
if (rc >= 0)
|
||||
out += sprintf(out, "%-16d", rc * mul_factor / div_factor);
|
||||
else
|
||||
out += sprintf(out, "%-16s", "write-only");
|
||||
@@ -431,7 +433,7 @@ static int proc_ide_read_settings
|
||||
}
|
||||
len = out - page;
|
||||
mutex_unlock(&ide_setting_mtx);
|
||||
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
|
||||
PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
|
||||
}
|
||||
|
||||
#define MAX_LEN 30
|
||||
@@ -512,8 +514,7 @@ static int proc_ide_write_settings(struct file *file, const char __user *buffer,
|
||||
|
||||
mutex_lock(&ide_setting_mtx);
|
||||
setting = ide_find_setting_by_name(drive, name);
|
||||
if (!setting)
|
||||
{
|
||||
if (!setting) {
|
||||
mutex_unlock(&ide_setting_mtx);
|
||||
goto parse_error;
|
||||
}
|
||||
@@ -533,8 +534,8 @@ parse_error:
|
||||
int proc_ide_read_capacity
|
||||
(char *page, char **start, off_t off, int count, int *eof, void *data)
|
||||
{
|
||||
int len = sprintf(page,"%llu\n", (long long)0x7fffffff);
|
||||
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
|
||||
int len = sprintf(page, "%llu\n", (long long)0x7fffffff);
|
||||
PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL_GPL(proc_ide_read_capacity);
|
||||
@@ -546,13 +547,13 @@ int proc_ide_read_geometry
|
||||
char *out = page;
|
||||
int len;
|
||||
|
||||
out += sprintf(out,"physical %d/%d/%d\n",
|
||||
out += sprintf(out, "physical %d/%d/%d\n",
|
||||
drive->cyl, drive->head, drive->sect);
|
||||
out += sprintf(out,"logical %d/%d/%d\n",
|
||||
out += sprintf(out, "logical %d/%d/%d\n",
|
||||
drive->bios_cyl, drive->bios_head, drive->bios_sect);
|
||||
|
||||
len = out - page;
|
||||
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
|
||||
PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(proc_ide_read_geometry);
|
||||
@@ -566,7 +567,7 @@ static int proc_ide_read_dmodel
|
||||
|
||||
len = sprintf(page, "%.40s\n",
|
||||
(id && id->model[0]) ? (char *)id->model : "(none)");
|
||||
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
|
||||
PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
|
||||
}
|
||||
|
||||
static int proc_ide_read_driver
|
||||
@@ -583,7 +584,7 @@ static int proc_ide_read_driver
|
||||
dev->driver->name, ide_drv->version);
|
||||
} else
|
||||
len = sprintf(page, "ide-default version 0.9.newide\n");
|
||||
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
|
||||
PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
|
||||
}
|
||||
|
||||
static int ide_replace_subdriver(ide_drive_t *drive, const char *driver)
|
||||
@@ -639,30 +640,26 @@ static int proc_ide_read_media
|
||||
int len;
|
||||
|
||||
switch (drive->media) {
|
||||
case ide_disk: media = "disk\n";
|
||||
break;
|
||||
case ide_cdrom: media = "cdrom\n";
|
||||
break;
|
||||
case ide_tape: media = "tape\n";
|
||||
break;
|
||||
case ide_floppy:media = "floppy\n";
|
||||
break;
|
||||
case ide_optical:media = "optical\n";
|
||||
break;
|
||||
default: media = "UNKNOWN\n";
|
||||
break;
|
||||
case ide_disk: media = "disk\n"; break;
|
||||
case ide_cdrom: media = "cdrom\n"; break;
|
||||
case ide_tape: media = "tape\n"; break;
|
||||
case ide_floppy: media = "floppy\n"; break;
|
||||
case ide_optical: media = "optical\n"; break;
|
||||
default: media = "UNKNOWN\n"; break;
|
||||
}
|
||||
strcpy(page,media);
|
||||
strcpy(page, media);
|
||||
len = strlen(media);
|
||||
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
|
||||
PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
|
||||
}
|
||||
|
||||
static ide_proc_entry_t generic_drive_entries[] = {
|
||||
{ "driver", S_IFREG|S_IRUGO, proc_ide_read_driver, proc_ide_write_driver },
|
||||
{ "identify", S_IFREG|S_IRUSR, proc_ide_read_identify, NULL },
|
||||
{ "media", S_IFREG|S_IRUGO, proc_ide_read_media, NULL },
|
||||
{ "model", S_IFREG|S_IRUGO, proc_ide_read_dmodel, NULL },
|
||||
{ "settings", S_IFREG|S_IRUSR|S_IWUSR,proc_ide_read_settings, proc_ide_write_settings },
|
||||
{ "driver", S_IFREG|S_IRUGO, proc_ide_read_driver,
|
||||
proc_ide_write_driver },
|
||||
{ "identify", S_IFREG|S_IRUSR, proc_ide_read_identify, NULL },
|
||||
{ "media", S_IFREG|S_IRUGO, proc_ide_read_media, NULL },
|
||||
{ "model", S_IFREG|S_IRUGO, proc_ide_read_dmodel, NULL },
|
||||
{ "settings", S_IFREG|S_IRUSR|S_IWUSR, proc_ide_read_settings,
|
||||
proc_ide_write_settings },
|
||||
{ NULL, 0, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -734,7 +731,6 @@ void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver)
|
||||
spin_unlock_irqrestore(&ide_lock, flags);
|
||||
mutex_unlock(&ide_setting_mtx);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(ide_proc_unregister_driver);
|
||||
|
||||
void ide_proc_port_register_devices(ide_hwif_t *hwif)
|
||||
@@ -755,7 +751,7 @@ void ide_proc_port_register_devices(ide_hwif_t *hwif)
|
||||
drive->proc = proc_mkdir(drive->name, parent);
|
||||
if (drive->proc)
|
||||
ide_add_proc_entries(drive->proc, generic_drive_entries, drive);
|
||||
sprintf(name,"ide%d/%s", (drive->name[2]-'a')/2, drive->name);
|
||||
sprintf(name, "ide%d/%s", (drive->name[2]-'a')/2, drive->name);
|
||||
ent = proc_symlink(drive->name, proc_ide_root, name);
|
||||
if (!ent) return;
|
||||
}
|
||||
@@ -795,7 +791,6 @@ void ide_pci_create_host_proc(const char *name, get_info_t *get_info)
|
||||
{
|
||||
create_proc_info_entry(name, 0, proc_ide_root, get_info);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL_GPL(ide_pci_create_host_proc);
|
||||
#endif
|
||||
|
||||
|
||||
+14
-55
@@ -100,13 +100,8 @@ int ide_noacpitfs = 1;
|
||||
int ide_noacpionboot = 1;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is declared extern in ide.h, for access by other IDE modules:
|
||||
*/
|
||||
ide_hwif_t ide_hwifs[MAX_HWIFS]; /* master data repository */
|
||||
|
||||
EXPORT_SYMBOL(ide_hwifs);
|
||||
|
||||
static void ide_port_init_devices_data(ide_hwif_t *);
|
||||
|
||||
/*
|
||||
@@ -232,30 +227,6 @@ static int ide_system_bus_speed(void)
|
||||
return pci_dev_present(pci_default) ? 33 : 50;
|
||||
}
|
||||
|
||||
ide_hwif_t * ide_find_port(unsigned long base)
|
||||
{
|
||||
ide_hwif_t *hwif;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_HWIFS; i++) {
|
||||
hwif = &ide_hwifs[i];
|
||||
if (hwif->io_ports[IDE_DATA_OFFSET] == base)
|
||||
goto found;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_HWIFS; i++) {
|
||||
hwif = &ide_hwifs[i];
|
||||
if (hwif->chipset == ide_unknown)
|
||||
goto found;
|
||||
}
|
||||
|
||||
hwif = NULL;
|
||||
found:
|
||||
return hwif;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL_GPL(ide_find_port);
|
||||
|
||||
static struct resource* hwif_request_region(ide_hwif_t *hwif,
|
||||
unsigned long addr, int num)
|
||||
{
|
||||
@@ -280,29 +251,21 @@ static struct resource* hwif_request_region(ide_hwif_t *hwif,
|
||||
int ide_hwif_request_regions(ide_hwif_t *hwif)
|
||||
{
|
||||
unsigned long addr;
|
||||
unsigned int i;
|
||||
|
||||
if (hwif->mmio)
|
||||
return 0;
|
||||
|
||||
addr = hwif->io_ports[IDE_CONTROL_OFFSET];
|
||||
|
||||
if (addr && !hwif_request_region(hwif, addr, 1))
|
||||
goto control_region_busy;
|
||||
hwif->straight8 = 0;
|
||||
|
||||
addr = hwif->io_ports[IDE_DATA_OFFSET];
|
||||
if ((addr | 7) == hwif->io_ports[IDE_STATUS_OFFSET]) {
|
||||
if (!hwif_request_region(hwif, addr, 8))
|
||||
goto data_region_busy;
|
||||
hwif->straight8 = 1;
|
||||
return 0;
|
||||
}
|
||||
for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
|
||||
addr = hwif->io_ports[i];
|
||||
if (!hwif_request_region(hwif, addr, 1)) {
|
||||
while (--i)
|
||||
release_region(addr, 1);
|
||||
goto data_region_busy;
|
||||
}
|
||||
}
|
||||
BUG_ON((addr | 7) != hwif->io_ports[IDE_STATUS_OFFSET]);
|
||||
|
||||
if (!hwif_request_region(hwif, addr, 8))
|
||||
goto data_region_busy;
|
||||
|
||||
return 0;
|
||||
|
||||
data_region_busy:
|
||||
@@ -328,19 +291,13 @@ control_region_busy:
|
||||
|
||||
void ide_hwif_release_regions(ide_hwif_t *hwif)
|
||||
{
|
||||
u32 i = 0;
|
||||
|
||||
if (hwif->mmio)
|
||||
return;
|
||||
|
||||
if (hwif->io_ports[IDE_CONTROL_OFFSET])
|
||||
release_region(hwif->io_ports[IDE_CONTROL_OFFSET], 1);
|
||||
if (hwif->straight8) {
|
||||
release_region(hwif->io_ports[IDE_DATA_OFFSET], 8);
|
||||
return;
|
||||
}
|
||||
for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++)
|
||||
if (hwif->io_ports[i])
|
||||
release_region(hwif->io_ports[i], 1);
|
||||
|
||||
release_region(hwif->io_ports[IDE_DATA_OFFSET], 8);
|
||||
}
|
||||
|
||||
void ide_remove_port_from_hwgroup(ide_hwif_t *hwif)
|
||||
@@ -627,11 +584,13 @@ out:
|
||||
int set_pio_mode(ide_drive_t *drive, int arg)
|
||||
{
|
||||
struct request rq;
|
||||
ide_hwif_t *hwif = drive->hwif;
|
||||
|
||||
if (arg < 0 || arg > 255)
|
||||
return -EINVAL;
|
||||
|
||||
if (drive->hwif->set_pio_mode == NULL)
|
||||
if (hwif->set_pio_mode == NULL ||
|
||||
(hwif->host_flags & IDE_HFLAG_NO_SET_MODE))
|
||||
return -ENOSYS;
|
||||
|
||||
if (drive->special.b.set_tune)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user