2023-09-30 19:16:42

by Ondrej Zary

[permalink] [raw]
Subject: [PATCH 1/4] pata_parport: fix pata_parport_devchk

There's a 'x' missing in 0x55 in pata_parport_devchk(), causing the
detection to always fail. Fix it.

Signed-off-by: Ondrej Zary <[email protected]>
---
drivers/ata/pata_parport/pata_parport.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ata/pata_parport/pata_parport.c b/drivers/ata/pata_parport/pata_parport.c
index 1af64d435d3c..258d189f42e5 100644
--- a/drivers/ata/pata_parport/pata_parport.c
+++ b/drivers/ata/pata_parport/pata_parport.c
@@ -64,7 +64,7 @@ static bool pata_parport_devchk(struct ata_port *ap, unsigned int device)
pi->proto->write_regr(pi, 0, ATA_REG_NSECT, 0xaa);
pi->proto->write_regr(pi, 0, ATA_REG_LBAL, 0x55);

- pi->proto->write_regr(pi, 0, ATA_REG_NSECT, 055);
+ pi->proto->write_regr(pi, 0, ATA_REG_NSECT, 0x55);
pi->proto->write_regr(pi, 0, ATA_REG_LBAL, 0xaa);

nsect = pi->proto->read_regr(pi, 0, ATA_REG_NSECT);
--
Ondrej Zary


2023-10-02 19:07:44

by Sergey Shtylyov

[permalink] [raw]
Subject: Re: [PATCH 1/4] pata_parport: fix pata_parport_devchk

Hello!

On 9/30/23 10:15 PM, Ondrej Zary wrote:

> There's a 'x' missing in 0x55 in pata_parport_devchk(), causing the
> detection to always fail. Fix it.
>
> Signed-off-by: Ondrej Zary <[email protected]>

I think we need a Fixes: tag here...

> ---
> drivers/ata/pata_parport/pata_parport.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/ata/pata_parport/pata_parport.c b/drivers/ata/pata_parport/pata_parport.c
> index 1af64d435d3c..258d189f42e5 100644
> --- a/drivers/ata/pata_parport/pata_parport.c
> +++ b/drivers/ata/pata_parport/pata_parport.c
> @@ -64,7 +64,7 @@ static bool pata_parport_devchk(struct ata_port *ap, unsigned int device)
> pi->proto->write_regr(pi, 0, ATA_REG_NSECT, 0xaa);
> pi->proto->write_regr(pi, 0, ATA_REG_LBAL, 0x55);
>
> - pi->proto->write_regr(pi, 0, ATA_REG_NSECT, 055);
> + pi->proto->write_regr(pi, 0, ATA_REG_NSECT, 0x55);

Oh, Gawd! How did this ever work?! :-/
This bug seems to predate the Big PARIDE move...

> pi->proto->write_regr(pi, 0, ATA_REG_LBAL, 0xaa);
>
> nsect = pi->proto->read_regr(pi, 0, ATA_REG_NSECT);
>

MBR, Sergey

2023-10-02 19:21:40

by Sergey Shtylyov

[permalink] [raw]
Subject: Re: [PATCH 1/4] pata_parport: fix pata_parport_devchk

On 10/2/23 9:43 PM, Sergey Shtylyov wrote:
[...]

>> There's a 'x' missing in 0x55 in pata_parport_devchk(), causing the
>> detection to always fail. Fix it.
>>
>> Signed-off-by: Ondrej Zary <[email protected]>
>
> I think we need a Fixes: tag here...

Fixes: 246a1c4c6b7f ("ata: pata_parport: add driver (PARIDE replacement)")

[...]

MBR, Sergey

2023-10-03 17:07:57

by Ondrej Zary

[permalink] [raw]
Subject: Re: [PATCH 1/4] pata_parport: fix pata_parport_devchk

On Monday 02 October 2023 20:43:09 Sergey Shtylyov wrote:
> Hello!
>
> On 9/30/23 10:15 PM, Ondrej Zary wrote:
>
> > There's a 'x' missing in 0x55 in pata_parport_devchk(), causing the
> > detection to always fail. Fix it.
> >
> > Signed-off-by: Ondrej Zary <[email protected]>
>
> I think we need a Fixes: tag here...
>
> > ---
> > drivers/ata/pata_parport/pata_parport.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/ata/pata_parport/pata_parport.c b/drivers/ata/pata_parport/pata_parport.c
> > index 1af64d435d3c..258d189f42e5 100644
> > --- a/drivers/ata/pata_parport/pata_parport.c
> > +++ b/drivers/ata/pata_parport/pata_parport.c
> > @@ -64,7 +64,7 @@ static bool pata_parport_devchk(struct ata_port *ap, unsigned int device)
> > pi->proto->write_regr(pi, 0, ATA_REG_NSECT, 0xaa);
> > pi->proto->write_regr(pi, 0, ATA_REG_LBAL, 0x55);
> >
> > - pi->proto->write_regr(pi, 0, ATA_REG_NSECT, 055);
> > + pi->proto->write_regr(pi, 0, ATA_REG_NSECT, 0x55);
>
> Oh, Gawd! How did this ever work?! :-/
> This bug seems to predate the Big PARIDE move...

This code was not present in PARIDE - it's my bug.
The function is a clone of ata_devchk() without direct port access.
It's called only from softreset so nobody notices the breakage until something goes wrong. The CD-865 drive needs a reset to start working.

--
Ondrej Zary

2023-10-03 17:18:40

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH 1/4] pata_parport: fix pata_parport_devchk

On 10/3/23 8:07 PM, Ondrej Zary wrote:
[...]

>>> There's a 'x' missing in 0x55 in pata_parport_devchk(), causing the
>>> detection to always fail. Fix it.
>>>
>>> Signed-off-by: Ondrej Zary <[email protected]>
>>
>> I think we need a Fixes: tag here...
>>
>>> ---
>>> drivers/ata/pata_parport/pata_parport.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/ata/pata_parport/pata_parport.c b/drivers/ata/pata_parport/pata_parport.c
>>> index 1af64d435d3c..258d189f42e5 100644
>>> --- a/drivers/ata/pata_parport/pata_parport.c
>>> +++ b/drivers/ata/pata_parport/pata_parport.c
>>> @@ -64,7 +64,7 @@ static bool pata_parport_devchk(struct ata_port *ap, unsigned int device)
>>> pi->proto->write_regr(pi, 0, ATA_REG_NSECT, 0xaa);
>>> pi->proto->write_regr(pi, 0, ATA_REG_LBAL, 0x55);
>>>
>>> - pi->proto->write_regr(pi, 0, ATA_REG_NSECT, 055);
>>> + pi->proto->write_regr(pi, 0, ATA_REG_NSECT, 0x55);
>>
>> Oh, Gawd! How did this ever work?! :-/
>> This bug seems to predate the Big PARIDE move...
>
> This code was not present in PARIDE - it's my bug.

Yes, I finally figured -- hence the Fixes: tag I suggested later....

> The function is a clone of ata_devchk() without direct port access.

The libata's taskfile methods suck big time -- I even used to have
the plans to clean this stuff up at some point...

> It's called only from softreset so nobody notices the breakage until something goes wrong. The CD-865 drive needs a reset to start working.

I thought the SRST reset is used at the initial detection phase as well...

MBR, Sergey