[PATCH] drivers/ide/ide.c to work with more IDE controllers

Bjorn Wesen (bjorn.wesen@axis.com)
Tue, 24 Apr 2001 14:29:44 +0200 (CEST)


This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.

--218787593-339488899-988115384=:17009
Content-Type: TEXT/PLAIN; charset=US-ASCII

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

--218787593-339488899-988115384=:17009
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="ide.c.patch"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.21.0104241429440.17009@godzilla.axis.se>
Content-Description:
Content-Disposition: attachment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RlcywNCisJCQkJICAgICBkcml2ZSwg
YnVmZmVyLCBieXRlY291bnQpOw0KKwkJcmV0dXJuOw0KKwl9DQorDQogCSsr
Ynl0ZWNvdW50Ow0KICNpZiBkZWZpbmVkKENPTkZJR19BVEFSSSkgfHwgZGVm
aW5lZChDT05GSUdfUTQwKQ0KIAlpZiAoTUFDSF9JU19BVEFSSSB8fCBNQUNI
X0lTX1E0MCkgew0KQEAgLTIwOTIsNiArMjEyMyw3IEBADQogCWh3aWYtPm1h
c2twcm9jCQk9IG9sZF9od2lmLm1hc2twcm9jOw0KIAlod2lmLT5xdWlya3By
b2MJCT0gb2xkX2h3aWYucXVpcmtwcm9jOw0KIAlod2lmLT5yd3Byb2MJCT0g
b2xkX2h3aWYucndwcm9jOw0KKwlod2lmLT5pZGVwcm9jCQk9IG9sZF9od2lm
LmlkZXByb2M7DQogCWh3aWYtPmRtYXByb2MJCT0gb2xkX2h3aWYuZG1hcHJv
YzsNCiAJaHdpZi0+ZG1hX2Jhc2UJCT0gb2xkX2h3aWYuZG1hX2Jhc2U7DQog
CWh3aWYtPmRtYV9leHRyYQkJPSBvbGRfaHdpZi5kbWFfZXh0cmE7DQpAQCAt
MzE5Myw2ICszMjI1LDEyIEBADQogCX0NCiAjZW5kaWYgLyogQ09ORklHX1BD
SSAqLw0KIA0KKyNpZmRlZiBDT05GSUdfRVRSQVhfSURFDQorCXsNCisJCWV4
dGVybiB2b2lkIGluaXRfZTEwMF9pZGUodm9pZCk7DQorCQlpbml0X2UxMDBf
aWRlKCk7DQorCX0NCisjZW5kaWYgLyogQ09ORklHX0VUUkFYX0lERSAqLw0K
ICNpZmRlZiBDT05GSUdfQkxLX0RFVl9DTUQ2NDANCiAJew0KIAkJZXh0ZXJu
IHZvaWQgaWRlX3Byb2JlX2Zvcl9jbWQ2NDB4KHZvaWQpOw0K
--218787593-339488899-988115384=:17009
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="ide.h.patch"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.21.0104241429441.17009@godzilla.axis.se>
Content-Description:
Content-Disposition: attachment; filename="ide.h.patch"

LS0tIC9ob21lL2Jqb3Judy90bXAvbGludXgvaW5jbHVkZS9saW51eC9pZGUu
aAlUaHUgSmFuICA0IDIzOjUxOjIxIDIwMDENCisrKyBsaW51eC9pbmNsdWRl
L2xpbnV4L2lkZS5oCVdlZCBBcHIgMTggMTM6NDk6NTQgMjAwMQ0KQEAgLTEz
MywxNCArMTMzLDYgQEANCiAjZGVmaW5lIElERV9CQ09VTlRMX1JFRwkJSURF
X0xDWUxfUkVHDQogI2RlZmluZSBJREVfQkNPVU5USF9SRUcJCUlERV9IQ1lM
X1JFRw0KIA0KLSNpZmRlZiBSRUFMTFlfRkFTVF9JTw0KLSNkZWZpbmUgT1VU
X0JZVEUoYixwKQkJb3V0YigoYiksKHApKQ0KLSNkZWZpbmUgSU5fQllURShw
KQkJKGJ5dGUpaW5iKHApDQotI2Vsc2UNCi0jZGVmaW5lIE9VVF9CWVRFKGIs
cCkJCW91dGJfcCgoYiksKHApKQ0KLSNkZWZpbmUgSU5fQllURShwKQkJKGJ5
dGUpaW5iX3AocCkNCi0jZW5kaWYgLyogUkVBTExZX0ZBU1RfSU8gKi8NCi0N
CiAjZGVmaW5lIEdFVF9FUlIoKQkJSU5fQllURShJREVfRVJST1JfUkVHKQ0K
ICNkZWZpbmUgR0VUX1NUQVQoKQkJSU5fQllURShJREVfU1RBVFVTX1JFRykN
CiAjZGVmaW5lIEdFVF9BTFRTVEFUKCkJCUlOX0JZVEUoSURFX0NPTlRST0xf
UkVHKQ0KQEAgLTI1NSw2ICsyNDcsMjcgQEANCiAjaW5jbHVkZSA8YXNtL2lk
ZS5oPg0KIA0KIC8qDQorICogSWYgdGhlIGFyY2gtZGVwZW5kYW50IGlkZS5o
IGRpZCBub3QgZGVjbGFyZS9kZWZpbmUgYW55IE9VVF9CWVRFDQorICogb3Ig
SU5fQllURSBmdW5jdGlvbnMsIHdlIG1ha2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dmVz
LA0KLQkJaWRlX3BtYWMNCisJCWlkZV9wbWFjLCAgICAgICBpZGVfZXRyYXgx
MDANCiB9IGh3aWZfY2hpcHNldF90Ow0KIA0KICNpZmRlZiBDT05GSUdfQkxL
X0RFVl9JREVQQ0kNCkBAIC00MzMsNiArNDYzLDcgQEANCiAJaWRlX21hc2tw
cm9jX3QJKm1hc2twcm9jOwkvKiBzcGVjaWFsIGhvc3QgbWFza2luZyBmb3Ig
ZHJpdmUgc2VsZWN0aW9uICovDQogCWlkZV9xdWlya3Byb2NfdAkqcXVpcmtw
cm9jOwkvKiBjaGVjayBob3N0J3MgZHJpdmUgcXVpcmsgbGlzdCAqLw0KIAlp
ZGVfcndfcHJvY190CSpyd3Byb2M7CS8qIGFkanVzdCB0aW1pbmcgYmFzZWQg
dXBvbiBycS0+Y21kIGRpcmVjdGlvbiAqLw0KKwlpZGVfaWRlcHJvY190ICAg
KmlkZXByb2M7ICAgICAgIC8qIENQVS1wb2xsZWQgdHJhbnNmZXIgcm91dGlu
ZSAqLw0KIAlpZGVfZG1hcHJvY190CSpkbWFwcm9jOwkvKiBkbWEgcmVhZC93
cml0ZS9hYm9ydCByb3V0aW5lICovDQogCXVuc2lnbmVkIGludAkqZG1hdGFi
bGVfY3B1OwkvKiBkbWEgcGh5c2ljYWwgcmVnaW9uIGRlc2NyaXB0b3IgdGFi
bGUgKGNwdSB2aWV3KSAqLw0KIAlkbWFfYWRkcl90CWRtYXRhYmxlX2RtYTsJ
LyogZG1hIHBoeXNpY2FsIHJlZ2lvbiBkZXNjcmlwdG9yIHRhYmxlIChkbWEg
dmlldykgKi8NCg==
--218787593-339488899-988115384=:17009
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="ide-makefile.patch"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.21.0104241429442.17009@godzilla.axis.se>
Content-Description:
Content-Disposition: attachment; filename="ide-makefile.patch"

LS0tIC9ob21lL2Jqb3Judy90bXAvbGludXgvZHJpdmVycy9pZGUvTWFrZWZp
bGUJRnJpIERlYyAyOSAyMzowNzoyMiAyMDAwDQorKysgbGludXgvZHJpdmVy
cy9pZGUvTWFrZWZpbGUJV2VkIEphbiAxMCAyMDozNDoxNSAyMDAxDQpAQCAt
NDIsNyArNDIsNyBAQA0KIGlkZS1vYmotJChDT05GSUdfQkxLX0RFVl9IUFQz
NjYpCSs9IGhwdDM2Ni5vDQogaWRlLW9iai0kKENPTkZJR19CTEtfREVWX0hU
NjU2MEIpCSs9IGh0NjU2MGIubw0KIGlkZS1vYmotJChDT05GSUdfQkxLX0RF
Vl9JREVfSUNTSURFKQkrPSBpY3NpZGUubw0KLWlkZS1vYmotJChDT05GSUdf
QkxLX0RFVl9JREVETUEpCSs9IGlkZS1kbWEubw0KK2lkZS1vYmotJChDT05G
SUdfQkxLX0RFVl9JREVETUFfUENJKQkrPSBpZGUtZG1hLm8NCiBpZGUtb2Jq
LSQoQ09ORklHX0JMS19ERVZfSURFUENJKQkrPSBpZGUtcGNpLm8NCiBpZGUt
b2JqLSQoQ09ORklHX0JMS19ERVZfSVNBUE5QKQkrPSBpZGUtcG5wLm8NCiBp
ZGUtb2JqLSQoQ09ORklHX0JMS19ERVZfSURFX1BNQUMpCSs9IGlkZS1wbWFj
Lm8NCg==
--218787593-339488899-988115384=:17009--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/