Linux PARISC architecture development
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@debian.org>
To: LaMont Jones <lamont@b180.mmjgroup.com>
Cc: parisc-linux@parisc-linux.org
Subject: Re: [parisc-linux] airo.c patch for hppa
Date: Wed, 4 Dec 2002 14:44:54 +0000	[thread overview]
Message-ID: <20021204144454.P27991@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <20021204050640.GA22117@b180.mmjgroup.com>; from lamont@b180.mmjgroup.com on Tue, Dec 03, 2002 at 10:06:40PM -0700

On Tue, Dec 03, 2002 at 10:06:40PM -0700, LaMont Jones wrote:
> The first part (chage to init_airo_card and it's callers) allows us to call
> pci_enable_device like we need to.

We certainly do...

> The other part (the stuff inside #ifdef __hppa__) is a gross hack that works
> around some issues between dino and the card during initialization where the
> card fails to ack reads of several 2-byte aligned addresses.  With these
> changes, I have a working PCI4800 in my B180.

Grant, I think this is a long-standing bug (Jan 2000!) in Dino's port IO macros.
Look:

#define DINO_PORT_IN(type, size, mask) \
static u##size dino_in##size (struct pci_hba_data *d, u16 addr) \
{ \
        /* tell HW which IO Port address */ \
        gsc_writel((u32) addr & ~3, d->base_addr + DINO_PCI_ADDR); \
        /* generate I/O PORT read cycle */ \
        v = gsc_read##type(d->base_addr+DINO_IO_DATA+(addr&mask)); \

That '& ~3' clears the bottom two bits of the address, so we always read
from a 32-bit aligned address, even if we actually wanted to read the
other 16-bit word or one of the other bytes.  The PORT_OUT define doesn't
mask that way:

#define DINO_PORT_OUT(type, size, mask) \
static void dino_out##size (struct pci_hba_data *d, u16 addr, u##size val) \
{ \
        /* tell HW which CFG address */ \
        gsc_writel((u32) addr, d->base_addr + DINO_PCI_ADDR); \
        /* generate cfg write cycle */ \
        gsc_write##type(cpu_to_le##size(val), d->base_addr+DINO_IO_DATA+(addr&ma
sk)); \

(oops, looks like a comment wasn't updated ;-)

And HPUX doesn't mask addr that way either:

#define DINO_PRE_RD_IO(this, addr) \
        WRITE_UINT32(this->base_addr + DINO_PCI_ADDR, addr);

STATIC uint16_t
dino_rd_io_w()
{
        off += (uint32_t) phndl;
        DINO_PRE_RD_IO(h2p, off);
        data = READ_UINT16(h2p->base_addr + DINO_IO_DATA + (off & 2));

LaMont's doing a rebuild now to check it works, but this seems fairly
obvious to me.  Thoughts?  (Can _anyone_ remember what they were thinking
when they wrote code nearly three years ago?  ;-)

-- 
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk

  reply	other threads:[~2002-12-04 14:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-04  5:06 [parisc-linux] airo.c patch for hppa LaMont Jones
2002-12-04 14:44 ` Matthew Wilcox [this message]
2002-12-04 17:12   ` Grant Grundler

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=20021204144454.P27991@parcelfarce.linux.theplanet.co.uk \
    --to=willy@debian.org \
    --cc=lamont@b180.mmjgroup.com \
    --cc=parisc-linux@parisc-linux.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