2001-03-27 07:26:53

by Richard Smith

[permalink] [raw]
Subject: Compact flash disk and slave drives in 2.4.2

I spent most of the day today trying to track down why the embedded system I am working
on would not recognize hdb on boot. It refused to show in the devices list even though I
specifically told the kernel it existed with the hdb=c,h,s option.

After working on what seemed like a hardware problem for quite a while I finally decided
that there must be something flaky in the ide driver code and began to add some debug
printk's

In which I found the following in ide.c:

/*
* CompactFlash cards and their brethern pretend to be removable hard disks,
* except:
* (1) they never have a slave unit, and
* (2) they don't have doorlock mechanisms.
* This test catches them, and is invoked elsewhere when setting appropriate
* config bits.
*
*/

Since hda in my system is a CompactFlash card I began to look further and then with some
discovered the following in ide-probe.c

/*
* Prevent long system lockup probing later for non-existant
* slave drive if the hwif is actually a flash memory card of some variety:
*/
if (drive_is_flashcard(drive)) {
ide_drive_t *mate = &HWIF(drive)->drives[1^drive->select.b.unit];
if (!mate->ata_flash) {
mate->present = 0;
ide_drive_t *mate = &HWIF(drive)->drives[1^drive->select.b.unit]
mate->noprobe = 1;
}
}

Now perhaps I am just way out on the wacky edge of things but I don't agree with the
above in the slightest. We use CF's in conjunction with slaves all the time. Almost all
of our embedded devices boot from CF's and I routinely add a HD as a slave to the system
to do developement with but it's always been under DOS.

I comment out the check above and all is well... hdb shows up as expected.

Can someone explain to me why the above check was added and if its continued existence is
necessary? Whats this long system lockup thing mentioned?

Even if there is some danger of a long lockup I suggest that at least a message that its
ignoring hdb is the least it could do rather than sliently ignoreing it. Especially when
I specifically told it a hdb existed via the command line. Shouldn't command line
parameters take precidence?

I not subscribed to the kernel-list so please copy me in the response.

Thanks.


--
Richard A. Smith [email protected]
"I'd hang out with science kids - they can blow things up!
I mean, what's cooler than that?"
- Tori Amos



2001-03-27 14:23:03

by Padraig Brady

[permalink] [raw]
Subject: Re: Compact flash disk and slave drives in 2.4.2

Can I just confirm that I'm seeing the same thing.
I'm using a pcengines compact flash adapter which has
a master/slave jumper, and this seems to confirm what
I thought, I.E. slaves are OK. Note I also had trouble where
HD was master and flashdisk was slave, where again the
CF was silently ignored.

Padraig.

Richard Smith wrote:

> I spent most of the day today trying to track down why the embedded system I am working
> on would not recognize hdb on boot. It refused to show in the devices list even though I
> specifically told the kernel it existed with the hdb=c,h,s option.
>
> After working on what seemed like a hardware problem for quite a while I finally decided
> that there must be something flaky in the ide driver code and began to add some debug
> printk's
>
> In which I found the following in ide.c:
>
> /*
> * CompactFlash cards and their brethern pretend to be removable hard disks,
> * except:
> * (1) they never have a slave unit, and
> * (2) they don't have doorlock mechanisms.
> * This test catches them, and is invoked elsewhere when setting appropriate
> * config bits.
> *
> */
>
> Since hda in my system is a CompactFlash card I began to look further and then with some
> discovered the following in ide-probe.c
>
> /*
> * Prevent long system lockup probing later for non-existant
> * slave drive if the hwif is actually a flash memory card of some variety:
> */
> if (drive_is_flashcard(drive)) {
> ide_drive_t *mate = &HWIF(drive)->drives[1^drive->select.b.unit];
> if (!mate->ata_flash) {
> mate->present = 0;
> ide_drive_t *mate = &HWIF(drive)->drives[1^drive->select.b.unit]
> mate->noprobe = 1;
> }
> }
>
> Now perhaps I am just way out on the wacky edge of things but I don't agree with the
> above in the slightest. We use CF's in conjunction with slaves all the time. Almost all
> of our embedded devices boot from CF's and I routinely add a HD as a slave to the system
> to do developement with but it's always been under DOS.
>
> I comment out the check above and all is well... hdb shows up as expected.
>
> Can someone explain to me why the above check was added and if its continued existence is
> necessary? Whats this long system lockup thing mentioned?
>
> Even if there is some danger of a long lockup I suggest that at least a message that its
> ignoring hdb is the least it could do rather than sliently ignoreing it. Especially when
> I specifically told it a hdb existed via the command line. Shouldn't command line
> parameters take precidence?
>
> I not subscribed to the kernel-list so please copy me in the response.
>
> Thanks.
>
>
> --
> Richard A. Smith [email protected]
> "I'd hang out with science kids - they can blow things up!
> I mean, what's cooler than that?"
> - Tori Amos
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

2001-03-27 16:43:53

by Andre Hedrick

[permalink] [raw]
Subject: Re: Compact flash disk and slave drives in 2.4.2


Because in laptops, the primary use of CFA.
Laptops using CFA do not have slaves.

Andre Hedrick
Linux ATA Development
ASL Kernel Development
-----------------------------------------------------------------------------
ASL, Inc. Toll free: 1-877-ASL-3535
1757 Houret Court Fax: 1-408-941-2071
Milpitas, CA 95035 Web: http://www.aslab.com

2001-03-27 17:08:43

by Padraig Brady

[permalink] [raw]
Subject: Re: Compact flash disk and slave drives in 2.4.2

OK the following assumes CF never have slaves which is just wrong.
The CF should be logically treated as an IDE harddisk. So the fix is
probably have a kernel parameter that causes the following check to
be skipped?

/*
* Prevent long system lockup probing later for non-existant
* slave drive if the hwif is actually a flash memory card of some
variety:
*/
if (drive_is_flashcard(drive)) {
ide_drive_t *mate = &HWIF(drive)->drives[1^drive->select.b.unit];
if (!mate->ata_flash) {
mate->present = 0;
ide_drive_t *mate =
&HWIF(drive)->drives[1^drive->select.b.unit]
mate->noprobe = 1;
}
}

But do we need this check? Is it just for speed. If you have an "ordinary"
harddrive as master with no slave, will the check for slave cause the same
"long system lockup", and if not, why.

Padraig.

Andre Hedrick wrote:

> Because in laptops, the primary use of CFA.
> Laptops using CFA do not have slaves.

2001-03-27 17:19:23

by Andre Hedrick

[permalink] [raw]
Subject: Re: Compact flash disk and slave drives in 2.4.2


Because 'real' ATA devices use a signature map the detects presense of
master slave during execute diagnostics. This is done in the BIOS.
CFA does no report this correctly and waiting for a 31 second time out is
not acceptable. If you have a complain take it to CFA commitee and have
them fix it.

I put in a walk around for having 2 CFA's to allow detection.
This will work also if you call it for a CFA+Disk pair.

On Tue, 27 Mar 2001, Padraig Brady wrote:

> OK the following assumes CF never have slaves which is just wrong.
> The CF should be logically treated as an IDE harddisk. So the fix is
> probably have a kernel parameter that causes the following check to
> be skipped?

Logically treated, is true, but again CFA does not follow the rules of
what the ATA committee gives them, and I refuse to break rules as the
standard model. Rule breaking are exceptions.

Also show me a case where a laptop will do master/slave in CFA.


> /*
> * Prevent long system lockup probing later for non-existant
> * slave drive if the hwif is actually a flash memory card of some
> variety:
> */
> if (drive_is_flashcard(drive)) {
> ide_drive_t *mate = &HWIF(drive)->drives[1^drive->select.b.unit];
> if (!mate->ata_flash) {
> mate->present = 0;
> ide_drive_t *mate =
> &HWIF(drive)->drives[1^drive->select.b.unit]
> mate->noprobe = 1;
> }
> }
>
> But do we need this check? Is it just for speed. If you have an "ordinary"
> harddrive as master with no slave, will the check for slave cause the same
> "long system lockup", and if not, why.
>
> Padraig.
>
> Andre Hedrick wrote:
>
> > Because in laptops, the primary use of CFA.
> > Laptops using CFA do not have slaves.
>

Andre Hedrick
Linux ATA Development
ASL Kernel Development
-----------------------------------------------------------------------------
ASL, Inc. Toll free: 1-877-ASL-3535
1757 Houret Court Fax: 1-408-941-2071
Milpitas, CA 95035 Web: http://www.aslab.com

2001-03-27 18:52:49

by Padraig Brady

[permalink] [raw]
Subject: Re: Compact flash disk and slave drives in 2.4.2

How do you activate the walk around you describe
to allow the detection of the slave? hda=ataflash?
Is this sort of stuff documented anywhere?

For those interested you also mention it here:
http://lists.sourceforge.net/archives//linux-usb-devel/2000-August/000929.html

This describes the other combination that causes
a problem where you have a normal disk as master
and the CF as slave:
http://boudicca.tux.org/hypermail/linux-kernel/2000week25/0973.html

Again the problem unresolved:
http://boudicca.tux.org/hypermail/linux-kernel/2000week26/0174.html

cheers,
Padraig.

Andre Hedrick wrote:

> Because 'real' ATA devices use a signature map the detects presense of
> master slave during execute diagnostics. This is done in the BIOS.
> CFA does no report this correctly and waiting for a 31 second time out is
> not acceptable. If you have a complain take it to CFA commitee and have
> them fix it.
>
> I put in a walk around for having 2 CFA's to allow detection.
> This will work also if you call it for a CFA+Disk pair.
>
> On Tue, 27 Mar 2001, Padraig Brady wrote:
>
>> OK the following assumes CF never have slaves which is just wrong.
>> The CF should be logically treated as an IDE harddisk. So the fix is
>> probably have a kernel parameter that causes the following check to
>> be skipped?
>
> Logically treated, is true, but again CFA does not follow the rules of
> what the ATA committee gives them, and I refuse to break rules as the
> standard model. Rule breaking are exceptions.
>
> Also show me a case where a laptop will do master/slave in CFA.
>
>> /*
>> * Prevent long system lockup probing later for non-existant
>> * slave drive if the hwif is actually a flash memory card of some
>> variety:
>> */
>> if (drive_is_flashcard(drive)) {
>> ide_drive_t *mate = &HWIF(drive)->drives[1^drive->select.b.unit];
>> if (!mate->ata_flash) {
>> mate->present = 0;
>> ide_drive_t *mate =
>> &HWIF(drive)->drives[1^drive->select.b.unit]
>> mate->noprobe = 1;
>> }
>> }
>>
>> But do we need this check? Is it just for speed. If you have an "ordinary"
>> harddrive as master with no slave, will the check for slave cause the same
>> "long system lockup", and if not, why.
>>
>> Padraig.
>>
>> Andre Hedrick wrote:
>>
>>
>>> Because in laptops, the primary use of CFA.
>>> Laptops using CFA do not have slaves.
>>
>
> Andre Hedrick
> Linux ATA Development
> ASL Kernel Development
> -----------------------------------------------------------------------------
> ASL, Inc. Toll free: 1-877-ASL-3535
> 1757 Houret Court Fax: 1-408-941-2071
> Milpitas, CA 95035 Web: http://www.aslab.com

2001-03-27 18:57:49

by Andre Hedrick

[permalink] [raw]
Subject: Re: Compact flash disk and slave drives in 2.4.2


./linux/drivers/ide/ide.c

* "hdx=flash" : allows for more than one ata_flash disk to be
* registered. In most cases, only one device
* will be present.


On Tue, 27 Mar 2001, Padraig Brady wrote:

> How do you activate the walk around you describe
> to allow the detection of the slave? hda=ataflash?
> Is this sort of stuff documented anywhere?
>
> For those interested you also mention it here:
> http://lists.sourceforge.net/archives//linux-usb-devel/2000-August/000929.html
>
> This describes the other combination that causes
> a problem where you have a normal disk as master
> and the CF as slave:
> http://boudicca.tux.org/hypermail/linux-kernel/2000week25/0973.html
>
> Again the problem unresolved:
> http://boudicca.tux.org/hypermail/linux-kernel/2000week26/0174.html
>
> cheers,
> Padraig.
>
> Andre Hedrick wrote:
>
> > Because 'real' ATA devices use a signature map the detects presense of
> > master slave during execute diagnostics. This is done in the BIOS.
> > CFA does no report this correctly and waiting for a 31 second time out is
> > not acceptable. If you have a complain take it to CFA commitee and have
> > them fix it.
> >
> > I put in a walk around for having 2 CFA's to allow detection.
> > This will work also if you call it for a CFA+Disk pair.
> >
> > On Tue, 27 Mar 2001, Padraig Brady wrote:
> >
> >> OK the following assumes CF never have slaves which is just wrong.
> >> The CF should be logically treated as an IDE harddisk. So the fix is
> >> probably have a kernel parameter that causes the following check to
> >> be skipped?
> >
> > Logically treated, is true, but again CFA does not follow the rules of
> > what the ATA committee gives them, and I refuse to break rules as the
> > standard model. Rule breaking are exceptions.
> >
> > Also show me a case where a laptop will do master/slave in CFA.
> >
> >> /*
> >> * Prevent long system lockup probing later for non-existant
> >> * slave drive if the hwif is actually a flash memory card of some
> >> variety:
> >> */
> >> if (drive_is_flashcard(drive)) {
> >> ide_drive_t *mate = &HWIF(drive)->drives[1^drive->select.b.unit];
> >> if (!mate->ata_flash) {
> >> mate->present = 0;
> >> ide_drive_t *mate =
> >> &HWIF(drive)->drives[1^drive->select.b.unit]
> >> mate->noprobe = 1;
> >> }
> >> }
> >>
> >> But do we need this check? Is it just for speed. If you have an "ordinary"
> >> harddrive as master with no slave, will the check for slave cause the same
> >> "long system lockup", and if not, why.
> >>
> >> Padraig.
> >>
> >> Andre Hedrick wrote:
> >>
> >>
> >>> Because in laptops, the primary use of CFA.
> >>> Laptops using CFA do not have slaves.
> >>
> >
> > Andre Hedrick
> > Linux ATA Development
> > ASL Kernel Development
> > -----------------------------------------------------------------------------
> > ASL, Inc. Toll free: 1-877-ASL-3535
> > 1757 Houret Court Fax: 1-408-941-2071
> > Milpitas, CA 95035 Web: http://www.aslab.com
>

Andre Hedrick
Linux ATA Development
ASL Kernel Development
-----------------------------------------------------------------------------
ASL, Inc. Toll free: 1-877-ASL-3535
1757 Houret Court Fax: 1-408-941-2071
Milpitas, CA 95035 Web: http://www.aslab.com

2001-03-27 19:26:50

by Richard Smith

[permalink] [raw]
Subject: Re: Compact flash disk and slave drives in 2.4.2

On Tue, 27 Mar 2001 09:17:48 -0800 (PST), Andre Hedrick wrote:

>not acceptable. If you have a complain take it to CFA commitee and have
>them fix it.

Well my only real complaints are that 1) It was done silently.. 2) I could not override it
w/o a code mod. Both of which are contrary to what I am accustom to when using linux.

>Logically treated, is true, but again CFA does not follow the rules of
>what the ATA committee gives them, and I refuse to break rules as the
>standard model. Rule breaking are exceptions.
>
>Also show me a case where a laptop will do master/slave in CFA.

Agreed... If CF does some wierd stuff then you shouldn't make the ATA driver break any
rules for it.. that wasn't what I was asking for. Just some why's and perhaps a message
that indicated what it was doing.

As for the laptops.. What laptops are you refering to? Don't most of them have some sort
of std laptop HD or an ibm microdrive thing. CF is terribly expensive compared to
mechanical HDs.

>/linux/drivers/ide/ide.c
>* "hdx=flash" : allows for more than one ata_flash disk to be
>* registered. In most cases, only one device
>* will be present.

Perhaps I missed something.. but this won't work for my original case. I have a CF as hda
and I was trying to hook up a mechanical HD as the slave. I specified hdb=c,h,s on the
command line but it was ignored.


--
Richard A. Smith Bitworks, Inc.
[email protected] 501.846.5777
Sr. Design Engineer http://www.bitworks.com


2001-03-27 20:17:40

by Andre Hedrick

[permalink] [raw]
Subject: Re: Compact flash disk and slave drives in 2.4.2


hdx=flash is only a flag to deal with flash.

a better description is probe-slave-with-master-flash, or
to-hell-with-flash-go-look.


On Tue, 27 Mar 2001, Richard A. Smith wrote:

> On Tue, 27 Mar 2001 09:17:48 -0800 (PST), Andre Hedrick wrote:
>
> >not acceptable. If you have a complain take it to CFA commitee and have
> >them fix it.
>
> Well my only real complaints are that 1) It was done silently.. 2) I could not override it
> w/o a code mod. Both of which are contrary to what I am accustom to when using linux.

Nothing is done privately or silently, sometime I try to second guess the
needs and add things so that when the question pops up, I can say, gee:
This was the guy that was going to ask that question, glad I had an early
answer.

It was addressed some time ago when there was a case of a firewall box
using two CFA's in a HOST->CFA thingy. This was where hda/hdb were both
CFA's

Override a probe that can hang a system is not going to happen.
You override the blocking flag first, then the generic overide is not
needed.

> >Logically treated, is true, but again CFA does not follow the rules of
> >what the ATA committee gives them, and I refuse to break rules as the
> >standard model. Rule breaking are exceptions.
> >
> >Also show me a case where a laptop will do master/slave in CFA.
>
> Agreed... If CF does some wierd stuff then you shouldn't make the ATA driver break any
> rules for it.. that wasn't what I was asking for. Just some why's and perhaps a message
> that indicated what it was doing.

The problem is that body does more things outside a commitee than it does
inside. So the docs do not reflect reality or impose usage rules.

> As for the laptops.. What laptops are you refering to? Don't most of them have some sort
> of std laptop HD or an ibm microdrive thing. CF is terribly expensive compared to
> mechanical HDs.

CFA is dropped into a pcmica/cardbus thingy.

Also there are no CFA's which are ATA devices by the definition, they
require a host-bridge to transport the signal. Handling host-bridges is
the problem. As more and stranger usages of these bridges happen the more
screwy thing get.

> >/linux/drivers/ide/ide.c
> >* "hdx=flash" : allows for more than one ata_flash disk to be
> >* registered. In most cases, only one device
> >* will be present.
>
> Perhaps I missed something.. but this won't work for my original case. I have a CF as hda
> and I was trying to hook up a mechanical HD as the slave. I specified hdb=c,h,s on the
> command line but it was ignored.

Again it is only a flag that allows for probing of a slave device if the
primary is a flash.

Now if the reactions/responses are wrong then it needs a fix, but to allow
systems to hang because of a nonexistant device is not something Linus
will allow, period.

>
> --
> Richard A. Smith Bitworks, Inc.
> [email protected] 501.846.5777
> Sr. Design Engineer http://www.bitworks.com
>
>

Andre Hedrick
Linux ATA Development
ASL Kernel Development
-----------------------------------------------------------------------------
ASL, Inc. Toll free: 1-877-ASL-3535
1757 Houret Court Fax: 1-408-941-2071
Milpitas, CA 95035 Web: http://www.aslab.com