linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
To: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
	Jeff Garzik <jeff@garzik.org>,
	linux-ide@vger.kernel.org
Subject: Re: [PATCH 12/15] ide: remove ->dma_master field from ide_hwif_t
Date: Thu, 04 Oct 2007 17:27:45 +0400	[thread overview]
Message-ID: <4704EA51.3040707@ru.mvista.com> (raw)
In-Reply-To: <47039024.3090705@ru.mvista.com>

Hello, I wrote:

>>>>>> * Convert cmd64x, hpt366 and pdc202xx_old host drivers to use
>>>>>>  pci_resource_start(hwif->pci_dev, 4) instead of hwif->dma_master.

>>>>> Before using pci_resource_start(), the code should check 
>>>>> pci_resource_len() to ensure it is the appropriate size.

>>>>> It would be very wise to ensure that 
>>>>> pci_resource_flags()&IORESOURCE_IO is true, too.

>>>> Sure but since the old code hasn't been doing these checks (old code
>>>> just did pci_resource_start() -> hwif->dma_base -> hwif->dma_master)
>>>> this is a separate issue from what the patch tries to achieve.

>>> Nonetheless this is duplicating an existing bug $N times... not ideal :)

>> The existing bug is that the methods converted to use 
>> pci_resource_start()
>> may be set in hwif instance and used even if the BAR4 is invalid.  
>> Therefore
>> the above patch is correct and it isn't duplicating the existing bug. :)

>> However I agree that all these pci_resource_start()s could be a bit 
>> confusing
>> so here is 'take 2'.

>    Yeah, they are.  Actually, I was thinking about such patch ~1.5 years 
> ago *but* using a different approach -- namely, hwif->extra_base.

    Yes, the code introducing this field was written with replacing dma_master 
by it in mind... It's a pity I haven't gotten around to it.

[...]

>> Index: b/drivers/ide/pci/hpt366.c
>> ===================================================================
>> --- a/drivers/ide/pci/hpt366.c
>> +++ b/drivers/ide/pci/hpt366.c
>> @@ -845,32 +845,33 @@ static int hpt374_ide_dma_end(ide_drive_

>    This just asks to be:

    No, it doesn't cause that way one would only break it.

>>  static void hpt3xxn_set_clock(ide_hwif_t *hwif, u8 mode)
>>  {
>     unsigned long base = hwif->extra_base;

    Sorry for a thinko. All offsets below shoud be really 0x6x, not 0x5x...

>     u8 scr2 = inb(base + 0x5b);
> 
>      if ((scr2 & 0x7f) == mode)
>          return;
> 
>      /* Tristate the bus */
>     outb(0x80, base + 0x53);
>     outb(0x80, base + 0x57);
> 
>      /* Switch clock and reset channels */
>     outb(mode, base + 0x5b);
>     outb(0xc0, base + 0x59);
> 
>      /*
>       * Reset the state machines.
>        * NOTE: avoid accidentally enabling the disabled channels.
>       */
>     outb(inb(base + 0x50) | 0x32, base + 0x50);
>     outb(inb(base + 0x54) | 0x32, base + 0x54);
> 
>      /* Complete reset */
>     outb(0x00, base + 0x59);
> 
>     /* Reconnect channels to bus */
>     outb(0x00, base + 0x53);
>     outb(0x00, base + 0x57);
> }

MBR, Sergei

  parent reply	other threads:[~2007-10-04 13:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-01 21:39 [PATCH 12/15] ide: remove ->dma_master field from ide_hwif_t Bartlomiej Zolnierkiewicz
2007-10-01 21:48 ` Jeff Garzik
2007-10-01 22:06   ` Bartlomiej Zolnierkiewicz
2007-10-01 22:31     ` Jeff Garzik
2007-10-02 21:24       ` Bartlomiej Zolnierkiewicz
2007-10-03 12:50         ` Sergei Shtylyov
2007-10-03 22:27           ` Bartlomiej Zolnierkiewicz
2007-10-04 13:27           ` Sergei Shtylyov [this message]
2007-10-08 21:03             ` Bartlomiej Zolnierkiewicz
2007-10-18 17:08               ` Sergei Shtylyov
2007-10-24 21:24                 ` Bartlomiej Zolnierkiewicz
2007-10-25 15:01                   ` Sergei Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4704EA51.3040707@ru.mvista.com \
    --to=sshtylyov@ru.mvista.com \
    --cc=bzolnier@gmail.com \
    --cc=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).