Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Oct 2003 23:17:47 +0900
From:      Hiroyuki Aizu <eyes@navi.org>
To:        current@freebsd.org
Subject:   PATCH for ATAng
Message-ID:  <20031016231747.4f0640e3.eyes@navi.org>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

--Multipart_Thu__16_Oct_2003_23_17_47_+0900_0865e200
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Hi.

The original ata_reset() lost ATA-master drive and remove main file system
after suspend/resume. Of cource it occors panic!
I think that the ata_reset() in ata-lowlevel.c is bogus and I can not
understand the code. So I study ATA and rewrite ata_reset() completely.

New device detect algorism using ata command ATA_IDENTIFY_DEVICE and
ATA_IDENTIFY_PACKET_DEVICE for judge ATA and ATAPI devices.

This patch works fine with my TOSHIBA Libretto L5. 
But not yet test ATAPI devices and ATA-slave channel.
Maybe there is need to adjust wait DELAY time.

Please test and replace ata_reset().

I hope this solve ATAng troubles.

--
Hiroyuki Aizu

--Multipart_Thu__16_Oct_2003_23_17_47_+0900_0865e200
Content-Type: application/octet-stream;
 name="ata-lowlevel.c.diff"
Content-Disposition: attachment;
 filename="ata-lowlevel.c.diff"
Content-Transfer-Encoding: base64

LS0tIGF0YS1sb3dsZXZlbC5jLm9yaWcJVGh1IE9jdCAgOSAyMzozMzowNiAyMDAzCisrKyBhdGEt
bG93bGV2ZWwuYwlUaHUgT2N0IDE2IDIyOjI4OjA2IDIwMDMKQEAgLTQ4OCwxNjIgKzQ4OCwyMjIg
QEAKIH0KIAogLyogbXVzdCBiZSBjYWxsZWQgd2l0aCBBVEEgY2hhbm5lbCBsb2NrZWQgKi8KLXN0
YXRpYyB2b2lkCi1hdGFfcmVzZXQoc3RydWN0IGF0YV9jaGFubmVsICpjaCkKKyNkZWZpbmUgQVRB
X1RJTUVPVVQJCQkxMDAwMAorI2RlZmluZSBBVEFfSURFTlRJRllfREVWSUNFCQkweGVjCisjZGVm
aW5lIEFUQV9JREVOVEl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BpbnQgbWFzayA9IDA7CisgICAgaW50IGRldmljZXMgPSAwOworICAgIGludCByZXQ7CisK
KyAgICBjaC0+ZGV2aWNlcyA9IDA7CisKKyAgICAvKiByZXNldCAqLworICAgIGlmIChhdGFfc29m
dF9yZXNldChjaCkpIHsKKyAgICAgICAgaWYgKGJvb3R2ZXJib3NlKQorICAgICAgICAgICAgYXRh
X3ByaW50ZihjaCwgLTEsICJlcnJvciBvciB0aW1lb3V0IHdoaWxlIHJlc2V0XG4iKTsKKyAgICAg
ICAgcmV0dXJuOworICAgIH0KKworICAgIC8qIGNoZWNrIE1BU1RFUiAqLworICAgIGlmIChhdGFf
ZGV2aWNlX3NlbGVjdChjaCwgQVRBX01BU1RFUikpCisgICAgICAgIHJldHVybjsKKyAgICByZXQg
PSBhdGFfY2hlY2tfZGV2aWNlX2V4aXN0ZW5jZShjaCk7CisgICAgaWYgKHJldCA+IDApIHsKKyAg
ICAgICAgbWFzayB8PSAweDAxOworICAgIH0KKworICAgIC8qIGNoZWNrIFNMQVZFICovCisgICAg
aWYgKGF0YV9kZXZpY2Vfc2VsZWN0KGNoLCBBVEFfU0xBVkUpKQorICAgICAgICByZXR1cm47Cisg
ICAgcmV0ID0gYXRhX2NoZWNrX2RldmljZV9leGlzdGVuY2UoY2gpOworICAgIGlmIChyZXQgPiAw
KSB7CisgICAgICAgIG1hc2sgfD0gMHgwMjsKKyAgICB9CisKKyAgICAvKiBBVEEgTUFTVEVSICov
CisgICAgaWYgKG1hc2sgJiAweDAxKSB7CisgICAgICAgIGlmICghYXRhX2RldmljZV9zZWxlY3Qo
Y2gsIEFUQV9NQVNURVIpKQorICAgICAgICAgICAgaWYgKCFpZGVudGlmeV9kZXZpY2UoY2gsIEFU
QV9NQVNURVIsIEFUQV9JREVOVElGWV9ERVZJQ0UpKQorICAgICAgICAgICAgICAgIGRldmljZXMg
fD0gQVRBX0FUQV9NQVNURVI7CisgICAgfQorCisgICAgLyogQVRBIFNMQVZFICovCisgICAgaWYg
KG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KKworICAgIGlmIChib290dmVyYm9zZSkKKyAg
ICAgICAgYXRhX3ByaW50ZihjaCwgLTEsICJyZXNldCBjaGVjayBmaW5hbDogZGV2aWNlcz0lMDJ4
XG4iLCBjaC0+ZGV2aWNlcyk7CisKKyAgICByZXR1cm47CiB9CiAKIHN0YXRpYyBpbnQK

--Multipart_Thu__16_Oct_2003_23_17_47_+0900_0865e200--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031016231747.4f0640e3.eyes>