Commit c0bf9449 authored by Martin Dalecki's avatar Martin Dalecki Committed by Linus Torvalds

[PATCH] 2.5.5 IDE cleanup 12

1. Add some notes to Documentation/driver-model.txt about how and
     and where to mount the driverfs.

2. Reorganize and prepare the PCI scanning code for proper device
dependant splitup. Basically tedious cleanup of macro games.

3. Use struct pci_dev name field as the name of PCI host dapaters
instead of invention ambigious IDE special names. This makes
the kernel bootup messages look a bit shifted, since those names are bit
longer, but makes up for consistance and should allow one later
to rearage things to fit into the generic PCI device initialization
mechanisms provided by the kernel.

4. Set 3. Allowed us to make the host chip specific
pci_init_xxx class functions have the proper signature of
module initializers. This will make it possible to make true
modules out of them later.

5. Make some functions in cmd64x.c static which where not used
elsewhere.

6. rename ide_special_settings to trust_pci_irq - this is reflecting
it's functionality better. And make it match the pci device vendor
as well as the device ID. It was a BUG to match only the device id!.

7. Make the chanell setup more tollerant for BIOS-es which don't
report IO and MEM bases properly. The code found previously there
tryed but was inconsistant.

8. Start to use proper terminology in ide-pci.c: host chip, channel,
drive instead of hwif, port, drive...

9. Enlarge the name field from ide_hwif_t to 64 bytes. It was only 6
previously and there where custom names there which where exceeding
this!!! But since we use the proper pci devce name there now instead,
we had to extend the size of this field anyway.

10. Add some explanatory comments and fix misguiding comments here and
there.

11. Kill the proc_ide_write_config and proc_ide_read_config brain
damage! Those where backdoors to the pci configuration registers on PCI
devices and IO registers on directly connected ISA ATA controllers.
They didn't discrement between them!

Access to both of them *simply* doesn't belong into an operating system,
which is supposed to abstract out the access to hardware! Did I mention
that access to both can be done from user land without an IDE special
interface! Any program which was using them (I hardly beleve there is
one) just deserves to loose. The programmer responsible for it
deserves to be fired immediately.

12. Move ide_map_xx and ide_unmap_xx tinny bio level wrappers away
from the "global" ide.h to where those are actually used and kill
trivial wrappers for otherwise generic bio_ routines. Just fighting
code obfuscation. The "rq->bio is used or is not there" brain
damage in ide-taskfile.c has to be fixed later. Possibly by killing
ide-taskfile.c alltogether, becouse this should be a driver for
users and not a driver for ATA disk disaster recovery companys...

13. Kill hwif->pci_devid and hwif->pci_venid. Just use the already
present hwif->pci_dev field instead.

14. Kill unused big switch ide_reinit_drive function. This silly
functon was switching upon every possible device driver cathegory
and calling the correspondng reinit function directly. This
idiocy was fortunately not used.

That's all... Most will be clear if one starts looking at the changes
in ide.h of course...

In contrast to the previous patches this one is actually fixing two
serious bugs.


The next direct step will be to kill the sigle place global PCI device
type recognition list from ide-pci.c by pushing the entries to where
they belong -> the host chips setup modules.
parent ce43a9ec
......@@ -118,7 +118,18 @@ User Interface
By virtue of having a complete hierarchical view of all the devices in the
system, exporting a complete hierarchical view to userspace becomes relatively
easy.
easy. This has been accomplished by implementing a special purpose virtual
file system named driverfs. It is hence possible for the user to mount the
whole driverfs on a particular mount point in the unified UNIX file hierarchy.
This can be done permanently by providing the following entry into the
/dev/fstab (under the provision that the mount point does exist, of course):
none /devices driverfs defaults 0 0
Or by hand on the command line:
~: mount -t driverfs none /devices
Whenever a device is inserted into the tree, a directory is created for it.
This directory may be populated at each layer of discovery - the global layer,
......@@ -343,6 +354,8 @@ user requests the system to suspend, it will walk the device tree, as exported
via driverfs, and tell each device to go to sleep. It will do this multiple
times based on what the system policy is.
[ FIXME: URL pointer to the corresponding utility is missing here! ]
Device resume should happen in the same manner when the system awakens.
Each suspend stage is described below:
......
......@@ -518,11 +518,11 @@ int aec62xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
#endif /* CONFIG_BLK_DEV_IDEDMA */
#endif /* CONFIG_AEC62XX_TUNING */
unsigned int __init pci_init_aec62xx (struct pci_dev *dev, const char *name)
unsigned int __init pci_init_aec62xx (struct pci_dev *dev)
{
if (dev->resource[PCI_ROM_RESOURCE].start) {
pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
printk("%s: ROM enabled at 0x%08lx\n", name, dev->resource[PCI_ROM_RESOURCE].start);
printk("%s: ROM enabled at 0x%08lx\n", dev->name, dev->resource[PCI_ROM_RESOURCE].start);
}
#if defined(DISPLAY_AEC62XX_TIMINGS) && defined(CONFIG_PROC_FS)
......
......@@ -504,7 +504,7 @@ static int ali15x3_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
unsigned int __init pci_init_ali15x3 (struct pci_dev *dev, const char *name)
unsigned int __init pci_init_ali15x3(struct pci_dev *dev)
{
unsigned long fixdma_base = pci_resource_start(dev, 4);
......@@ -523,7 +523,7 @@ unsigned int __init pci_init_ali15x3 (struct pci_dev *dev, const char *name)
outb(inb(fixdma_base+2) & 0x60, fixdma_base+2);
if (inb(fixdma_base+2) & 0x80)
printk("%s: simplex device: DMA will fail!!\n", name);
printk("%s: simplex device: DMA will fail!!\n", dev->name);
}
#if defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_PROC_FS)
......
......@@ -406,13 +406,13 @@ int amd74xx_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
unsigned int __init pci_init_amd74xx (struct pci_dev *dev, const char *name)
unsigned int __init pci_init_amd74xx(struct pci_dev *dev)
{
unsigned long fixdma_base = pci_resource_start(dev, 4);
#ifdef CONFIG_BLK_DEV_IDEDMA
if (!amd74xx_swdma_check(dev))
printk("%s: disabling single-word DMA support (revision < C4)\n", name);
printk("%s: disabling single-word DMA support (revision < C4)\n", dev->name);
#endif /* CONFIG_BLK_DEV_IDEDMA */
if (!fixdma_base) {
......@@ -426,7 +426,7 @@ unsigned int __init pci_init_amd74xx (struct pci_dev *dev, const char *name)
outb(inb(fixdma_base+2) & 0x60, fixdma_base+2);
if (inb(fixdma_base+2) & 0x80)
printk("%s: simplex device: DMA will fail!!\n", name);
printk("%s: simplex device: DMA will fail!!\n", dev->name);
}
#if defined(DISPLAY_VIPER_TIMINGS) && defined(CONFIG_PROC_FS)
if (!amd74xx_proc) {
......
......@@ -954,7 +954,7 @@ static int cmd680_busproc (ide_drive_t * drive, int state)
return 0;
}
void cmd680_reset (ide_drive_t *drive)
static void cmd680_reset (ide_drive_t *drive)
{
#if 0
ide_hwif_t *hwif = HWIF(drive);
......@@ -966,7 +966,7 @@ void cmd680_reset (ide_drive_t *drive)
#endif
}
unsigned int cmd680_pci_init (struct pci_dev *dev, const char *name)
static unsigned int cmd680_pci_init(struct pci_dev *dev)
{
u8 tmpbyte = 0;
pci_write_config_byte(dev, 0x80, 0x00);
......@@ -992,7 +992,7 @@ unsigned int cmd680_pci_init (struct pci_dev *dev, const char *name)
return 0;
}
unsigned int cmd64x_pci_init (struct pci_dev *dev, const char *name)
static unsigned int cmd64x_pci_init(struct pci_dev *dev)
{
unsigned char mrdmode;
unsigned int class_rev;
......@@ -1003,7 +1003,7 @@ unsigned int cmd64x_pci_init (struct pci_dev *dev, const char *name)
#ifdef __i386__
if (dev->resource[PCI_ROM_RESOURCE].start) {
pci_write_config_byte(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
printk("%s: ROM enabled at 0x%08lx\n", name, dev->resource[PCI_ROM_RESOURCE].start);
printk("%s: ROM enabled at 0x%08lx\n", dev->name, dev->resource[PCI_ROM_RESOURCE].start);
}
#endif
......@@ -1011,7 +1011,7 @@ unsigned int cmd64x_pci_init (struct pci_dev *dev, const char *name)
case PCI_DEVICE_ID_CMD_643:
break;
case PCI_DEVICE_ID_CMD_646:
printk("%s: chipset revision 0x%02X, ", name, class_rev);
printk("%s: chipset revision 0x%02X, ", dev->name, class_rev);
switch(class_rev) {
case 0x07:
case 0x05:
......@@ -1081,11 +1081,11 @@ unsigned int cmd64x_pci_init (struct pci_dev *dev, const char *name)
return 0;
}
unsigned int __init pci_init_cmd64x (struct pci_dev *dev, const char *name)
unsigned int __init pci_init_cmd64x(struct pci_dev *dev)
{
if (dev->device == PCI_DEVICE_ID_CMD_680)
return cmd680_pci_init (dev, name);
return cmd64x_pci_init (dev, name);
return cmd680_pci_init (dev);
return cmd64x_pci_init (dev);
}
unsigned int cmd680_ata66 (ide_hwif_t *hwif)
......
......@@ -251,7 +251,7 @@ int cs5530_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
/*
* Initialize the cs5530 bridge for reliable IDE DMA operation.
*/
unsigned int __init pci_init_cs5530 (struct pci_dev *dev, const char *name)
unsigned int __init pci_init_cs5530(struct pci_dev *dev)
{
struct pci_dev *master_0 = NULL, *cs5530_0 = NULL;
unsigned short pcicmd = 0;
......@@ -278,11 +278,11 @@ unsigned int __init pci_init_cs5530 (struct pci_dev *dev, const char *name)
}
}
if (!master_0) {
printk("%s: unable to locate PCI MASTER function\n", name);
printk("%s: unable to locate PCI MASTER function\n", dev->name);
return 0;
}
if (!cs5530_0) {
printk("%s: unable to locate CS5530 LEGACY function\n", name);
printk("%s: unable to locate CS5530 LEGACY function\n", dev->name);
return 0;
}
......
......@@ -383,7 +383,7 @@ static void cy82c693_tune_drive (ide_drive_t *drive, byte pio)
* the device prior to INIT.
*/
unsigned int __init pci_init_cy82c693(struct pci_dev *dev, const char *name)
unsigned int __init pci_init_cy82c693(struct pci_dev *dev)
{
#ifdef CY82C693_SETDMA_CLOCK
byte data;
......@@ -399,7 +399,7 @@ unsigned int __init pci_init_cy82c693(struct pci_dev *dev, const char *name)
data = IN_BYTE(CY82_DATA_PORT);
#if CY82C693_DEBUG_INFO
printk (KERN_INFO "%s: Peripheral Configuration Register: 0x%X\n", name, data);
printk (KERN_INFO "%s: Peripheral Configuration Register: 0x%X\n", dev->name, data);
#endif /* CY82C693_DEBUG_INFO */
/*
......@@ -420,7 +420,7 @@ unsigned int __init pci_init_cy82c693(struct pci_dev *dev, const char *name)
OUT_BYTE(data, CY82_DATA_PORT);
#if CY82C693_DEBUG_INFO
printk (KERN_INFO "%s: New Peripheral Configuration Register: 0x%X\n", name, data);
printk (KERN_INFO "%s: New Peripheral Configuration Register: 0x%X\n", dev->name, data);
#endif /* CY82C693_DEBUG_INFO */
#endif /* CY82C693_SETDMA_CLOCK */
......@@ -433,7 +433,7 @@ unsigned int __init pci_init_cy82c693(struct pci_dev *dev, const char *name)
void __init ide_init_cy82c693(ide_hwif_t *hwif)
{
hwif->chipset = ide_cy82c693;
hwif->tuneproc = &cy82c693_tune_drive;
hwif->tuneproc = cy82c693_tune_drive;
hwif->drives[0].autotune = 1;
hwif->drives[1].autotune = 1;
hwif->autodma = 0;
......@@ -441,7 +441,7 @@ void __init ide_init_cy82c693(ide_hwif_t *hwif)
#ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) {
hwif->highmem = 1;
hwif->dmaproc = &cy82c693_dmaproc;
hwif->dmaproc = cy82c693_dmaproc;
if (!noautodma)
hwif->autodma = 1;
}
......
......@@ -357,7 +357,7 @@ int hpt34x_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
*/
#define HPT34X_PCI_INIT_REG 0x80
unsigned int __init pci_init_hpt34x (struct pci_dev *dev, const char *name)
unsigned int __init pci_init_hpt34x(struct pci_dev *dev)
{
int i = 0;
unsigned long hpt34xIoBase = pci_resource_start(dev, 4);
......
......@@ -1097,7 +1097,7 @@ static void __init init_hpt370(struct pci_dev *dev)
udelay(100);
}
unsigned int __init pci_init_hpt366 (struct pci_dev *dev, const char *name)
unsigned int __init pci_init_hpt366(struct pci_dev *dev)
{
byte test = 0;
......
This diff is collapsed.
......@@ -127,242 +127,8 @@ extern byte via_proc;
int (*via_display_info)(char *, char **, off_t, int) = NULL;
#endif /* CONFIG_BLK_DEV_VIA82CXXX */
static int ide_getxdigit(char c)
{
int digit;
if (isdigit(c))
digit = c - '0';
else if (isxdigit(c))
digit = tolower(c) - 'a' + 10;
else
digit = -1;
return digit;
}
static int xx_xx_parse_error (const char *data, unsigned long len, const char *msg)
{
char errbuf[16];
int i;
if (len >= sizeof(errbuf))
len = sizeof(errbuf) - 1;
for (i = 0; i < len; ++i) {
char c = data[i];
if (!c || c == '\n')
c = '\0';
else if (iscntrl(c))
c = '?';
errbuf[i] = c;
}
errbuf[i] = '\0';
printk("proc_ide: error: %s: '%s'\n", msg, errbuf);
return -EINVAL;
}
static struct proc_dir_entry * proc_ide_root = NULL;
static int proc_ide_write_config
(struct file *file, const char *buffer, unsigned long count, void *data)
{
ide_hwif_t *hwif = data;
int for_real = 0;
unsigned long startn = 0, n, flags;
const char *start = NULL, *msg = NULL;
if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
return -EACCES;
/*
* Skip over leading whitespace
*/
while (count && isspace(*buffer)) {
--count;
++buffer;
}
/*
* Do one full pass to verify all parameters,
* then do another to actually write the regs.
*/
save_flags(flags); /* all CPUs */
do {
const char *p;
if (for_real) {
unsigned long timeout = jiffies + (3 * HZ);
ide_hwgroup_t *mygroup = (ide_hwgroup_t *)(hwif->hwgroup);
ide_hwgroup_t *mategroup = NULL;
if (hwif->mate && hwif->mate->hwgroup)
mategroup = (ide_hwgroup_t *)(hwif->mate->hwgroup);
cli(); /* all CPUs; ensure all writes are done together */
while (test_bit(IDE_BUSY, &mygroup->flags) || (mategroup && test_bit(IDE_BUSY, &mategroup->flags))) {
sti(); /* all CPUs */
if (0 < (signed long)(jiffies - timeout)) {
printk("/proc/ide/%s/config: channel(s) busy, cannot write\n", hwif->name);
restore_flags(flags); /* all CPUs */
return -EBUSY;
}
cli(); /* all CPUs */
}
}
p = buffer;
n = count;
while (n > 0) {
int d, digits;
unsigned int reg = 0, val = 0, is_pci;
start = p;
startn = n--;
switch (*p++) {
case 'R': is_pci = 0;
break;
case 'P': is_pci = 1;
#ifdef CONFIG_BLK_DEV_IDEPCI
if (hwif->pci_dev && !IDE_PCI_DEVID_EQ(hwif->pci_devid, IDE_PCI_DEVID_NULL))
break;
#endif /* CONFIG_BLK_DEV_IDEPCI */
msg = "not a PCI device";
goto parse_error;
default: msg = "expected 'R' or 'P'";
goto parse_error;
}
digits = 0;
while (n > 0 && (d = ide_getxdigit(*p)) >= 0) {
reg = (reg << 4) | d;
--n;
++p;
++digits;
}
if (!digits || (digits > 4) || (is_pci && reg > 0xff)) {
msg = "bad/missing register number";
goto parse_error;
}
if (n-- == 0 || *p++ != ':') {
msg = "missing ':'";
goto parse_error;
}
digits = 0;
while (n > 0 && (d = ide_getxdigit(*p)) >= 0) {
val = (val << 4) | d;
--n;
++p;
++digits;
}
if (digits != 2 && digits != 4 && digits != 8) {
msg = "bad data, 2/4/8 digits required";
goto parse_error;
}
if (n > 0 && !isspace(*p)) {
msg = "expected whitespace after data";
goto parse_error;
}
while (n > 0 && isspace(*p)) {
--n;
++p;
}
#ifdef CONFIG_BLK_DEV_IDEPCI
if (is_pci && (reg & ((digits >> 1) - 1))) {
msg = "misaligned access";
goto parse_error;
}
#endif /* CONFIG_BLK_DEV_IDEPCI */
if (for_real) {
#if 0
printk("proc_ide_write_config: type=%c, reg=0x%x, val=0x%x, digits=%d\n", is_pci ? "PCI" : "non-PCI", reg, val, digits);
#endif
if (is_pci) {
#ifdef CONFIG_BLK_DEV_IDEPCI
int rc = 0;
struct pci_dev *dev = hwif->pci_dev;
switch (digits) {
case 2: msg = "byte";
rc = pci_write_config_byte(dev, reg, val);
break;
case 4: msg = "word";
rc = pci_write_config_word(dev, reg, val);
break;
case 8: msg = "dword";
rc = pci_write_config_dword(dev, reg, val);
break;
}
if (rc) {
restore_flags(flags); /* all CPUs */
printk("proc_ide_write_config: error writing %s at bus %02x dev %02x reg 0x%x value 0x%x\n",
msg, dev->bus->number, dev->devfn, reg, val);
printk("proc_ide_write_config: error %d\n", rc);
return -EIO;
}
#endif /* CONFIG_BLK_DEV_IDEPCI */
} else { /* not pci */
#if !defined(__mc68000__) && !defined(CONFIG_APUS)
/*
* Geert Uytterhoeven
*
* unless you can explain me what it really does.
* On m68k, we don't have outw() and outl() yet,
* and I need a good reason to implement it.
*
* BTW, IMHO the main remaining portability problem with the IDE driver
* is that it mixes IO (ioport) and MMIO (iomem) access on different platforms.
*
* I think all accesses should be done using
*
* ide_in[bwl](ide_device_instance, offset)
* ide_out[bwl](ide_device_instance, value, offset)
*
* so the architecture specific code can #define ide_{in,out}[bwl] to the
* appropriate function.
*
*/
switch (digits) {
case 2: outb(val, reg);
break;
case 4: outw(val, reg);
break;
case 8: outl(val, reg);
break;
}
#endif /* !__mc68000__ && !CONFIG_APUS */
}
}
}
} while (!for_real++);
restore_flags(flags); /* all CPUs */
return count;
parse_error:
restore_flags(flags); /* all CPUs */
printk("parse error\n");
return xx_xx_parse_error(start, startn, msg);
}
static int proc_ide_read_config
(char *page, char **start, off_t off, int count, int *eof, void *data)
{
char *out = page;
int len;
#ifdef CONFIG_BLK_DEV_IDEPCI
ide_hwif_t *hwif = data;
struct pci_dev *dev = hwif->pci_dev;
if (!IDE_PCI_DEVID_EQ(hwif->pci_devid, IDE_PCI_DEVID_NULL) && dev && dev->bus) {
int reg = 0;
out += sprintf(out, "pci bus %02x device %02x vid %04x did %04x channel %d\n",
dev->bus->number, dev->devfn, hwif->pci_devid.vid, hwif->pci_devid.did, hwif->channel);
do {
byte val;
int rc = pci_read_config_byte(dev, reg, &val);
if (rc) {
printk("proc_ide_read_config: error %d reading bus %02x dev %02x reg 0x%02x\n",
rc, dev->bus->number, dev->devfn, reg);
out += sprintf(out, "??%c", (++reg & 0xf) ? ' ' : '\n');
} else
out += sprintf(out, "%02x%c", val, (++reg & 0xf) ? ' ' : '\n');
} while (reg < 0x100);
} else
#endif /* CONFIG_BLK_DEV_IDEPCI */
out += sprintf(out, "(none)\n");
len = out - page;
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
}
static int ide_getdigit(char c)
{
int digit;
......@@ -785,7 +551,6 @@ void destroy_proc_ide_drives(ide_hwif_t *hwif)
static ide_proc_entry_t hwif_entries[] = {
{ "channel", S_IFREG|S_IRUGO, proc_ide_read_channel, NULL },
{ "config", S_IFREG|S_IRUGO|S_IWUSR,proc_ide_read_config, proc_ide_write_config },
{ "mate", S_IFREG|S_IRUGO, proc_ide_read_mate, NULL },
{ "model", S_IFREG|S_IRUGO, proc_ide_read_imodel, NULL },
{ NULL, 0, NULL, NULL }
......
......@@ -42,6 +42,24 @@
#define DTF(x...)
#endif
/*
* for now, taskfile requests are special :/
*/
static inline char *ide_map_rq(struct request *rq, unsigned long *flags)
{
if (rq->bio)
return bio_kmap_irq(rq->bio, flags) + ide_rq_offset(rq);
else
return rq->buffer + task_rq_offset(rq);
}
static inline void ide_unmap_rq(struct request *rq, char *to,
unsigned long *flags)
{
if (rq->bio)
bio_kunmap_irq(to, flags);
}
inline u32 task_read_24 (ide_drive_t *drive)
{
return (IN_BYTE(IDE_HCYL_REG)<<16) |
......@@ -1137,7 +1155,7 @@ ide_startstop_t bio_mulout_intr (ide_drive_t *drive)
nsect = mcount;
mcount -= nsect;
buffer = ide_map_buffer(rq, &flags);
buffer = bio_kmap_irq(rq->bio, &flags) + ide_rq_offset(rq);
rq->sector += nsect;
rq->nr_sectors -= nsect;
rq->current_nr_sectors -= nsect;
......@@ -1161,7 +1179,7 @@ ide_startstop_t bio_mulout_intr (ide_drive_t *drive)
* re-entering us on the last transfer.
*/
taskfile_output_data(drive, buffer, nsect * SECTOR_WORDS);
ide_unmap_buffer(buffer, &flags);
bio_kunmap_irq(buffer, &flags);
} while (mcount);
drive->io_32bit = io_32bit;
......
......@@ -1781,8 +1781,8 @@ void ide_intr (int irq, void *dev_id, struct pt_regs *regs)
* so in that case we just ignore it and hope it goes away.
*/
#ifdef CONFIG_BLK_DEV_IDEPCI
if (IDE_PCI_DEVID_EQ(hwif->pci_devid, IDE_PCI_DEVID_NULL))
#endif /* CONFIG_BLK_DEV_IDEPCI */
if (hwif->pci_dev && !hwif->pci_dev->vendor)
#endif
{
/*
* Probably not a shared PCI interrupt,
......@@ -1794,7 +1794,7 @@ void ide_intr (int irq, void *dev_id, struct pt_regs *regs)
/*
* Whack the status register, just in case we have a leftover pending IRQ.
*/
(void) IN_BYTE(hwif->io_ports[IDE_STATUS_OFFSET]);
IN_BYTE(hwif->io_ports[IDE_STATUS_OFFSET]);
#endif /* CONFIG_BLK_DEV_IDEPCI */
}
goto out_lock;
......@@ -2304,7 +2304,6 @@ void ide_unregister (unsigned int index)
hwif->udma_four = old_hwif.udma_four;
#ifdef CONFIG_BLK_DEV_IDEPCI
hwif->pci_dev = old_hwif.pci_dev;
hwif->pci_devid = old_hwif.pci_devid;
#endif /* CONFIG_BLK_DEV_IDEPCI */
hwif->straight8 = old_hwif.straight8;
hwif->hwif_data = old_hwif.hwif_data;
......@@ -2650,61 +2649,6 @@ void ide_delay_50ms (void)
#endif /* CONFIG_BLK_DEV_IDECS */
}
int ide_reinit_drive (ide_drive_t *drive)
{
switch (drive->media) {
#ifdef CONFIG_BLK_DEV_IDECD
case ide_cdrom:
{
extern int ide_cdrom_reinit(ide_drive_t *drive);
if (ide_cdrom_reinit(drive))
return 1;
break;
}
#endif /* CONFIG_BLK_DEV_IDECD */
#ifdef CONFIG_BLK_DEV_IDEDISK
case ide_disk:
{
extern int idedisk_reinit(ide_drive_t *drive);
if (idedisk_reinit(drive))
return 1;
break;
}
#endif /* CONFIG_BLK_DEV_IDEDISK */
#ifdef CONFIG_BLK_DEV_IDEFLOPPY
case ide_floppy:
{
extern int idefloppy_reinit(ide_drive_t *drive);
if (idefloppy_reinit(drive))
return 1;
break;
}
#endif /* CONFIG_BLK_DEV_IDEFLOPPY */
#ifdef CONFIG_BLK_DEV_IDETAPE
case ide_tape:
{
extern int idetape_reinit(ide_drive_t *drive);
if (idetape_reinit(drive))
return 1;
break;
}
#endif /* CONFIG_BLK_DEV_IDETAPE */
#ifdef CONFIG_BLK_DEV_IDESCSI
/*
* {
* extern int idescsi_reinit(ide_drive_t *drive);
* if (idescsi_reinit(drive))
* return 1;
* break;
* }
*/
#endif /* CONFIG_BLK_DEV_IDESCSI */
default:
return 1;
}
return 0;
}
static int ide_ioctl (struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
......@@ -3559,20 +3503,20 @@ void __init ide_init_builtin_drivers (void)
* Attempt to match drivers for the available drives
*/
#ifdef CONFIG_BLK_DEV_IDEDISK
(void) idedisk_init();
idedisk_init();
#endif /* CONFIG_BLK_DEV_IDEDISK */
#ifdef CONFIG_BLK_DEV_IDECD
(void) ide_cdrom_init();
ide_cdrom_init();
#endif /* CONFIG_BLK_DEV_IDECD */
#ifdef CONFIG_BLK_DEV_IDETAPE
(void) idetape_init();
idetape_init();
#endif /* CONFIG_BLK_DEV_IDETAPE */
#ifdef CONFIG_BLK_DEV_IDEFLOPPY
(void) idefloppy_init();
idefloppy_init();
#endif /* CONFIG_BLK_DEV_IDEFLOPPY */
#ifdef CONFIG_BLK_DEV_IDESCSI
#ifdef CONFIG_SCSI
(void) idescsi_init();
idescsi_init();
#else
#warning ide scsi-emulation selected but no SCSI-subsystem in kernel
#endif
......@@ -3672,6 +3616,9 @@ ide_drive_t *ide_scan_devices (byte media, const char *name, ide_driver_t *drive
return NULL;
}
/*
* This is in fact registering a drive not a driver.
*/
int ide_register_subdriver (ide_drive_t *drive, ide_driver_t *driver)
{
unsigned long flags;
......@@ -3832,7 +3779,6 @@ EXPORT_SYMBOL(ide_unregister);
EXPORT_SYMBOL(ide_setup_ports);
EXPORT_SYMBOL(get_info_ptr);
EXPORT_SYMBOL(current_capacity);
EXPORT_SYMBOL(ide_reinit_drive);
static int ide_notify_reboot (struct notifier_block *this, unsigned long event, void *x)
{
......
......@@ -53,7 +53,6 @@ static int it8172_tune_chipset (ide_drive_t *drive, byte speed);
static int it8172_config_drive_for_dma (ide_drive_t *drive);
static int it8172_dmaproc(ide_dma_action_t func, ide_drive_t *drive);
#endif
unsigned int __init pci_init_it8172 (struct pci_dev *dev, const char *name);
void __init ide_init_it8172 (ide_hwif_t *hwif);
......@@ -232,7 +231,7 @@ static int it8172_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
#endif /* defined(CONFIG_BLK_DEV_IDEDMA) && (CONFIG_IT8172_TUNING) */
unsigned int __init pci_init_it8172 (struct pci_dev *dev, const char *name)
unsigned int __init pci_init_it8172 (struct pci_dev *dev)
{
unsigned char progif;
......
......@@ -1102,7 +1102,7 @@ static int pdc202xx_tristate (ide_drive_t * drive, int state)
return 0;
}
unsigned int __init pci_init_pdc202xx (struct pci_dev *dev, const char *name)
unsigned int __init pci_init_pdc202xx(struct pci_dev *dev)
{
unsigned long high_16 = pci_resource_start(dev, 4);
byte udma_speed_flag = IN_BYTE(high_16 + 0x001f);
......@@ -1112,7 +1112,7 @@ unsigned int __init pci_init_pdc202xx (struct pci_dev *dev, const char *name)
if (dev->resource[PCI_ROM_RESOURCE].start) {
pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
printk("%s: ROM enabled at 0x%08lx\n", name, dev->resource[PCI_ROM_RESOURCE].start);
printk("%s: ROM enabled at 0x%08lx\n", dev->name, dev->resource[PCI_ROM_RESOURCE].start);
}
switch (dev->device) {
......@@ -1151,7 +1151,7 @@ unsigned int __init pci_init_pdc202xx (struct pci_dev *dev, const char *name)
pci_read_config_byte(dev, (PCI_INTERRUPT_LINE)|0x80, &irq2); /* 0xbc */
if (irq != irq2) {
pci_write_config_byte(dev, (PCI_INTERRUPT_LINE)|0x80, irq); /* 0xbc */
printk("%s: pci-config space interrupt mirror fixed.\n", name);
printk("%s: pci-config space interrupt mirror fixed.\n", dev->name);
}
}
break;
......@@ -1163,14 +1163,14 @@ unsigned int __init pci_init_pdc202xx (struct pci_dev *dev, const char *name)
printk("%s: (U)DMA Burst Bit %sABLED " \
"Primary %s Mode " \
"Secondary %s Mode.\n",
name,
dev->name,
(udma_speed_flag & 1) ? "EN" : "DIS",
(primary_mode & 1) ? "MASTER" : "PCI",
(secondary_mode & 1) ? "MASTER" : "PCI" );
#ifdef CONFIG_PDC202XX_BURST
if (!(udma_speed_flag & 1)) {
printk("%s: FORCING BURST BIT 0x%02x -> 0x%02x ", name, udma_speed_flag, (udma_speed_flag|1));
printk("%s: FORCING BURST BIT 0x%02x -> 0x%02x ", dev->name, udma_speed_flag, (udma_speed_flag|1));
OUT_BYTE(udma_speed_flag|1, high_16 + 0x001f);
printk("%sCTIVE\n", (IN_BYTE(high_16 + 0x001f) & 1) ? "A" : "INA");
}
......@@ -1179,14 +1179,14 @@ unsigned int __init pci_init_pdc202xx (struct pci_dev *dev, const char *name)
#ifdef CONFIG_PDC202XX_MASTER
if (!(primary_mode & 1)) {
printk("%s: FORCING PRIMARY MODE BIT 0x%02x -> 0x%02x ",
name, primary_mode, (primary_mode|1));
dev->name, primary_mode, (primary_mode|1));
OUT_BYTE(primary_mode|1, high_16 + 0x001a);
printk("%s\n", (IN_BYTE(high_16 + 0x001a) & 1) ? "MASTER" : "PCI");
}
if (!(secondary_mode & 1)) {
printk("%s: FORCING SECONDARY MODE BIT 0x%02x -> 0x%02x ",
name, secondary_mode, (secondary_mode|1));
dev->name, secondary_mode, (secondary_mode|1));
OUT_BYTE(secondary_mode|1, high_16 + 0x001b);
printk("%s\n", (IN_BYTE(high_16 + 0x001b) & 1) ? "MASTER" : "PCI");
}
......
......@@ -332,14 +332,14 @@ static ide_startstop_t promise_read_intr (ide_drive_t *drive)
if (nsect > sectors_avail)
nsect = sectors_avail;
sectors_avail -= nsect;
to = ide_map_buffer(rq, &flags);
to = bio_kmap_irq(rq->bio, &flags) + ide_rq_offset(rq);
ata_input_data(drive, to, nsect * SECTOR_WORDS);
#ifdef DEBUG_READ
printk(KERN_DEBUG "%s: promise_read: sectors(%ld-%ld), "
"buf=0x%08lx, rem=%ld\n", drive->name, rq->sector,
rq->sector+nsect-1, (unsigned long) to, rq->nr_sectors-nsect);
#endif
ide_unmap_buffer(to, &flags);
bio_kunmap_irq(to, &flags);
rq->sector += nsect;
rq->errors = 0;
rq->nr_sectors -= nsect;
......@@ -437,7 +437,7 @@ int promise_multwrite (ide_drive_t *drive, unsigned int mcount)
nsect = mcount;
mcount -= nsect;
buffer = ide_map_buffer(rq, &flags);
buffer = bio_kmap_irq(rq->bio, flags) + ide_rq_offset(rq);
rq->sector += nsect;
rq->nr_sectors -= nsect;
rq->current_nr_sectors -= nsect;
......@@ -461,7 +461,7 @@ int promise_multwrite (ide_drive_t *drive, unsigned int mcount)
* re-entering us on the last transfer.
*/
taskfile_output_data(drive, buffer, nsect<<7);
ide_unmap_buffer(buffer, &flags);
bio_kunmap_irq(buffer, &flags);
} while (mcount);
return 0;
......
......@@ -71,7 +71,7 @@ int pdcadma_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
unsigned int __init pci_init_pdcadma (struct pci_dev *dev, const char *name)
unsigned int __init pci_init_pdcadma(struct pci_dev *dev)
{
#if defined(DISPLAY_PDCADMA_TIMINGS) && defined(CONFIG_PROC_FS)
if (!pdcadma_proc) {
......
......@@ -451,7 +451,7 @@ static int piix_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
}
#endif /* defined(CONFIG_BLK_DEV_IDEDMA) && (CONFIG_PIIX_TUNING) */
unsigned int __init pci_init_piix (struct pci_dev *dev, const char *name)
unsigned int __init pci_init_piix(struct pci_dev *dev)
{
#if defined(DISPLAY_PIIX_TIMINGS) && defined(CONFIG_PROC_FS)
if (!piix_proc) {
......
......@@ -547,7 +547,7 @@ static int svwks_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
unsigned int __init pci_init_svwks (struct pci_dev *dev, const char *name)
unsigned int __init pci_init_svwks(struct pci_dev *dev)
{
unsigned int reg;
byte btr;
......
......@@ -567,7 +567,7 @@ int sis5513_dmaproc (ide_dma_action_t func, ide_drive_t *drive)
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
unsigned int __init pci_init_sis5513 (struct pci_dev *dev, const char *name)
unsigned int __init pci_init_sis5513(struct pci_dev *dev)
{
struct pci_dev *host;
int i = 0;
......
......@@ -223,7 +223,7 @@ static unsigned int sl82c105_bridge_revision(struct pci_dev *dev)
/*
* Enable the PCI device
*/
unsigned int __init pci_init_sl82c105(struct pci_dev *dev, const char *msg)
unsigned int __init pci_init_sl82c105(struct pci_dev *dev)
{
unsigned char ctrl_stat;
......
......@@ -347,7 +347,7 @@ static int slc90e66_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
}
#endif /* CONFIG_BLK_DEV_IDEDMA */
unsigned int __init pci_init_slc90e66 (struct pci_dev *dev, const char *name)
unsigned int __init pci_init_slc90e66(struct pci_dev *dev)
{
#if defined(DISPLAY_SLC90E66_TIMINGS) && defined(CONFIG_PROC_FS)
if (!slc90e66_proc) {
......
......@@ -393,7 +393,7 @@ int via82cxxx_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
* and initialize its drive independent registers.
*/
unsigned int __init pci_init_via82cxxx(struct pci_dev *dev, const char *name)
unsigned int __init pci_init_via82cxxx(struct pci_dev *dev)
{
struct pci_dev *isa = NULL;
unsigned char t, v;
......
......@@ -521,16 +521,6 @@ typedef void (ide_rw_proc_t) (ide_drive_t *, ide_dma_action_t);
*/
typedef int (ide_busproc_t) (ide_drive_t *, int);
#ifdef CONFIG_BLK_DEV_IDEPCI
typedef struct ide_pci_devid_s {
unsigned short vid;
unsigned short did;
} ide_pci_devid_t;
#define IDE_PCI_DEVID_NULL ((ide_pci_devid_t){0,0})
#define IDE_PCI_DEVID_EQ(a,b) (a.vid == b.vid && a.did == b.did)
#endif /* CONFIG_BLK_DEV_IDEPCI */
typedef struct hwif_s {
struct hwif_s *next; /* for linked-list in ide_hwgroup_t */
struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */
......@@ -575,8 +565,7 @@ typedef struct hwif_s {
byte channel; /* for dual-port chips: 0=primary, 1=secondary */
#ifdef CONFIG_BLK_DEV_IDEPCI
struct pci_dev *pci_dev; /* for pci chipsets */
ide_pci_devid_t pci_devid; /* for pci chipsets: {VID,DID} */
#endif /* CONFIG_BLK_DEV_IDEPCI */
#endif
#if (DISK_RECOVERY_TIME > 0)
unsigned long last_time; /* time when previous rq was done */
#endif
......@@ -850,34 +839,6 @@ typedef enum {
#define task_rq_offset(rq) \
(((rq)->nr_sectors - (rq)->current_nr_sectors) * SECTOR_SIZE)
extern inline void *ide_map_buffer(struct request *rq, unsigned long *flags)
{
return bio_kmap_irq(rq->bio, flags) + ide_rq_offset(rq);
}
extern inline void ide_unmap_buffer(char *buffer, unsigned long *flags)
{
bio_kunmap_irq(buffer, flags);
}
/*
* for now, taskfile requests are special :/
*/
extern inline char *ide_map_rq(struct request *rq, unsigned long *flags)
{
if (rq->bio)
return ide_map_buffer(rq, flags);
else
return rq->buffer + task_rq_offset(rq);
}
extern inline void ide_unmap_rq(struct request *rq, char *buf,
unsigned long *flags)
{
if (rq->bio)
ide_unmap_buffer(buf, flags);
}
/*
* This function issues a special IDE device request
* onto the request queue.
......@@ -1027,8 +988,6 @@ void ide_init_subdrivers (void);
extern struct block_device_operations ide_fops[];
extern ide_proc_entry_t generic_subdriver_entries[];
extern int ide_reinit_drive (ide_drive_t *drive);
#ifdef CONFIG_BLK_DEV_IDE
/* Probe for devices attached to the systems host controllers.
*/
......@@ -1069,7 +1028,7 @@ extern int ide_replace_subdriver(ide_drive_t *drive, const char *driver);
# define OFF_BOARD NEVER_BOARD
#endif /* CONFIG_BLK_DEV_OFFBOARD */
void ide_scan_pcibus (int scan_direction) __init;
void __init ide_scan_pcibus(int scan_direction);
#endif
#ifdef CONFIG_BLK_DEV_IDEDMA
#define BAD_DMA_DRIVE 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