2001-04-24 12:31:04

by Bjorn Wesen

[permalink] [raw]
Subject: [PATCH] drivers/ide/ide.c to work with more IDE controllers

Hi!

Problem description:

* drivers/ide/ide.c assumes the IDE controller is mapped in such a way
that it can access it by "hardcoded" I/O commands (IN_BYTE/OUT_BYTE)

* drivers/ide/ide.c assumes that polled ide/atapi transfers should be
done the way a PC would

* drivers/ide/Makefile assumes that all IDE DMA controllers are PCI

This makes it impossible to use for example the IDE-driver for the Etrax
controller (arch/cris) which is not memory-mapped and is not PCI-based.

The following trivial patches (against 2.4.4-pre6 but are probably
appliable to any 2.4.3-ac as well) fix the problem:

* In include/linux/ide.h, do #ifdef HAVE_ARCH_IN_BYTE etc. around the
definitions of IN_BYTE and OUT_BYTE (allowing include/asm/ide.h to
bypass the standard definition - see asm-cris/ide.h for an example)

* Add the "ideproc" entry in the HW driver structure, and let
ide_input_bytes and friends in ide.c test that first. If it exists,
it uses it, otherwise just do the normal PC transfer

* In the Makefile, let ide-dma.c (which is really PCI DMA only) be
included by CONFIG_BLK_DEV_IDEDMA_PCI instead of just
CONFIG_BLK_DEV_IDEDMA

* (Un)related addition: add ide_etrax100 as a chipset enum and an init
call to the etrax IDE driver under #ifdef CONFIG_ETRAX_IDE

Please comment. It should all be trivial but there is one thing I'm unsure
about and that is if it's guaranteed that the HWIF's structures are nulled
upon creation (or maybe, if the primordial HWIF is nulled when copies are
made). Obviously the above patch depends on any HWIF to have NULL as
'ideproc' if it does not need any alternative function there.

Regards,
Bjorn


Attachments:
ide.c.patch (2.23 kB)
ide.h.patch (2.91 kB)
ide-makefile.patch (544.00 B)
Download all attachments